org.exolab.castor.xml.Marshaller.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.exolab.castor.xml.Marshaller.<init>()方法的一些代码示例,展示了Marshaller.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.<init>()方法的具体详情如下:
包路径:org.exolab.castor.xml.Marshaller
类名称:Marshaller
方法名:<init>

Marshaller.<init>介绍

[英]Creates a default instance of Marshaller, where the sink needs to be set separately.
[中]创建Marshaller的默认实例,其中接收器需要单独设置。

代码示例

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Creates a new {@link Marshaller} instance to be used for marshalling.
 * 
 * @return A new {@link Marshaller} instance.
 */
public Marshaller createMarshaller() {
 if (LOG.isDebugEnabled()) {
  LOG.debug("Creating new Marshaller instance.");
 }
 Marshaller marshaller = new Marshaller(_internalContext);
 return marshaller;
}

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Marshals the given Object as XML using the given DocumentHandler to send events to.
 *
 * @param object The Object to marshal.
 * @param handler The DocumentHandler to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, DocumentHandler handler)
  throws MarshalException, ValidationException {
 staticMarshal(object, new Marshaller(handler));
} // -- marshal

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Marshals the given Object as XML using the given DOM Node
 * to send events to.
 *
 * @param object The Object to marshal.
 * @param node The DOM Node to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, Node node)
throws MarshalException, ValidationException {
  staticMarshal(object, new Marshaller(node));
} //-- marshal

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Creates a new {@link Marshaller} instance to be used for marshalling.
 * @return A new {@link Marshaller} instance.
 */
public Marshaller createMarshaller() {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Creating new Marshaller instance.");
  }
  Marshaller marshaller = new Marshaller();
  marshaller.setInternalContext(_internalContext);
  return marshaller;
}

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Marshals the given Object as XML using the given ContentHandler to send events to.
 *
 * @param object The Object to marshal.
 * @param handler The ContentHandler to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, ContentHandler handler)
  throws MarshalException, ValidationException {
 staticMarshal(object, new Marshaller(handler));
} // -- marshal

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Marshals the given Object as XML using the given DOM Node to send events to.
 *
 * @param object The Object to marshal.
 * @param node The DOM Node to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, Node node)
  throws MarshalException, ValidationException {
 staticMarshal(object, new Marshaller(node));
} // -- marshal

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Marshals the given Object as XML using the given DocumentHandler
 * to send events to.
 *
 * @param object The Object to marshal.
 * @param handler The DocumentHandler to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, DocumentHandler handler)
throws MarshalException, ValidationException {
  staticMarshal(object, new Marshaller(handler));
} //-- marshal

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Marshals the given Object as XML using the given ContentHandler
 * to send events to.
 *
 * @param object The Object to marshal.
 * @param handler The ContentHandler to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, ContentHandler handler)
throws MarshalException, ValidationException, IOException {
  staticMarshal(object, new Marshaller(handler));
} //-- marshal

代码示例来源:origin: org.codehaus.castor/castor-jdo

public void saveHistory() {
  // write back the history to file
  try {
    FileWriter writer = new FileWriter("queryhistory.xml");
    Marshaller marshaller = new Marshaller(writer);
    marshaller.setMapping(_mapping);
    marshaller.marshal(_qhistory);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Marshals the given Object as XML using the given writer.
 *
 * @param object The Object to marshal.
 * @param out The writer to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, Writer out)
  throws MarshalException, ValidationException {
 try {
  staticMarshal(object, new Marshaller(out));
 } catch (IOException e) {
  throw new MarshalException(e);
 }
} // -- marshal

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Marshals the given Object as XML using the given writer.
 *
 * @param object The Object to marshal.
 * @param out The writer to marshal to.
 * @exception org.exolab.castor.xml.MarshalException
 * @exception org.exolab.castor.xml.ValidationException
 */
public static void marshal(Object object, Writer out)
throws MarshalException, ValidationException {
  try {
    staticMarshal(object, new Marshaller(out));
  } catch (IOException e) {
    throw new MarshalException(e);
  }
} //-- marshal

代码示例来源:origin: org.codehaus.castor/castor-codegen

/**
 * Generates the mapping file.
 * 
 * @param packageName Package name to be generated
 * @param sInfo Source Generator current state
 * @throws IOException if this Exception occurs while generating the mapping file
 */
private void generateMappingFile(final String packageName, final SGStateInfo sInfo)
  throws IOException {
 String pkg = (packageName != null) ? packageName : "";
 MappingRoot mapping = sInfo.getMapping(pkg);
 if (mapping == null) {
  return;
 }
 FileWriter writer = new FileWriter(_mappingFilename);
 try {
  Marshaller marshaller = new Marshaller(writer);
  marshaller.setSuppressNamespaces(true);
  marshaller.marshal(mapping);
 } catch (Exception ex) {
  throw new NestedIOException(ex);
 } finally {
  writer.flush();
  writer.close();
 }
}

代码示例来源:origin: org.codehaus.castor/castor-xml

/**
 * Serializes the mapping to the given writer.
 * 
 * @param writer the Writer to serialize the mapping to
 * @throws MappingException if writing the mapping information fails
 */
public void write(final Writer writer) throws MappingException {
 Marshaller marshal;
 MappingRoot mapping;
 Enumeration enumeration;
 try {
  mapping = new MappingRoot();
  mapping.setDescription("Castor generated mapping file");
  enumeration = _mappings.elements();
  while (enumeration.hasMoreElements()) {
   mapping.addClassMapping((ClassMapping) enumeration.nextElement());
  }
  marshal = new Marshaller(writer);
  marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
  marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
  marshal.marshal(mapping);
 } catch (Exception except) {
  throw new MappingException(except);
 }
} // -- write

代码示例来源:origin: org.codehaus.castor/com.springsource.org.castor

/**
 * Serializes the mapping to the given writer.
 * 
 * @param writer
 *            the Writer to serialize the mapping to
 * @throws MappingException if writing the mapping information fails
 */
public void write(final Writer writer) throws MappingException {
  Marshaller marshal;
  MappingRoot mapping;
  Enumeration enumeration;
  try {
    mapping = new MappingRoot();
    mapping.setDescription("Castor generated mapping file");
    enumeration = _mappings.elements();
    while (enumeration.hasMoreElements()) {
      mapping.addClassMapping((ClassMapping) enumeration.nextElement());
    }
    marshal = new Marshaller(writer);
    marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
    marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
    marshal.marshal(mapping);
  } catch (Exception except) {
    throw new MappingException(except);
  }
} // -- write

代码示例来源:origin: axis/axis

try {
  AxisContentHandler hand = new AxisContentHandler(context);
  Marshaller marshaller = new Marshaller(hand);

代码示例来源:origin: org.apache.axis/axis

try {
  AxisContentHandler hand = new AxisContentHandler(context);
  Marshaller marshaller = new Marshaller(hand);

代码示例来源:origin: org.apache.axis/com.springsource.org.apache.axis

try {
  AxisContentHandler hand = new AxisContentHandler(context);
  Marshaller marshaller = new Marshaller(hand);

代码示例来源:origin: com.github.muff1nman.chameleon/core

/**
   * Initializes the Castor mapping instance.
   * @param mapping a Castor mapping. Shall not be <code>null</code>.
   * @throws NullPointerException if <code>mapping</code> is <code>null</code>.
   * @throws MappingException an exception indicating an invalid mapping error.
   */
  private void setMapping(final Mapping mapping) throws MappingException
  {
    _unmarshaller = new Unmarshaller(mapping); // May throw MappingException.
    _unmarshaller.setValidation(false);
    _unmarshaller.setIgnoreExtraElements(true);

    _marshaller = new Marshaller();
    _marshaller.setMapping(mapping); // May throw MappingException.
    _marshaller.setValidation(false);
    //_marshaller.setDebug(true);
    // Specifies whether to support XML namespaces by default. Default is false.
    //_marshaller.setProperty("org.exolab.castor.parser.namespaces", "true");
    // Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
    //_marshaller.setProperty("org.exolab.castor.indent", "true");
  }
}

代码示例来源:origin: org.codehaus.xfire/xfire-castor

marshaller = new Marshaller(new SafeContentHandler(new ContentHandlerToXMLStreamWriter(
    sWriter)));
marshaller.setRootElement(part.getName().getLocalPart());

代码示例来源:origin: org.apache.portals.jetspeed-2/jetspeed-page-manager

final ContentHandler handler = xmlWriter;
Marshaller marshaller = new Marshaller(new ContentHandler()

相关文章