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

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

本文整理了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

  1. /**
  2. * Creates a new {@link Marshaller} instance to be used for marshalling.
  3. *
  4. * @return A new {@link Marshaller} instance.
  5. */
  6. public Marshaller createMarshaller() {
  7. if (LOG.isDebugEnabled()) {
  8. LOG.debug("Creating new Marshaller instance.");
  9. }
  10. Marshaller marshaller = new Marshaller(_internalContext);
  11. return marshaller;
  12. }

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

  1. /**
  2. * Marshals the given Object as XML using the given DocumentHandler to send events to.
  3. *
  4. * @param object The Object to marshal.
  5. * @param handler The DocumentHandler to marshal to.
  6. * @exception org.exolab.castor.xml.MarshalException
  7. * @exception org.exolab.castor.xml.ValidationException
  8. */
  9. public static void marshal(Object object, DocumentHandler handler)
  10. throws MarshalException, ValidationException {
  11. staticMarshal(object, new Marshaller(handler));
  12. } // -- marshal

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

  1. /**
  2. * Marshals the given Object as XML using the given DOM Node
  3. * to send events to.
  4. *
  5. * @param object The Object to marshal.
  6. * @param node The DOM Node to marshal to.
  7. * @exception org.exolab.castor.xml.MarshalException
  8. * @exception org.exolab.castor.xml.ValidationException
  9. */
  10. public static void marshal(Object object, Node node)
  11. throws MarshalException, ValidationException {
  12. staticMarshal(object, new Marshaller(node));
  13. } //-- marshal

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

  1. /**
  2. * Creates a new {@link Marshaller} instance to be used for marshalling.
  3. * @return A new {@link Marshaller} instance.
  4. */
  5. public Marshaller createMarshaller() {
  6. if (LOG.isDebugEnabled()) {
  7. LOG.debug("Creating new Marshaller instance.");
  8. }
  9. Marshaller marshaller = new Marshaller();
  10. marshaller.setInternalContext(_internalContext);
  11. return marshaller;
  12. }

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

  1. /**
  2. * Marshals the given Object as XML using the given ContentHandler to send events to.
  3. *
  4. * @param object The Object to marshal.
  5. * @param handler The ContentHandler to marshal to.
  6. * @exception org.exolab.castor.xml.MarshalException
  7. * @exception org.exolab.castor.xml.ValidationException
  8. */
  9. public static void marshal(Object object, ContentHandler handler)
  10. throws MarshalException, ValidationException {
  11. staticMarshal(object, new Marshaller(handler));
  12. } // -- marshal

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

  1. /**
  2. * Marshals the given Object as XML using the given DOM Node to send events to.
  3. *
  4. * @param object The Object to marshal.
  5. * @param node The DOM Node to marshal to.
  6. * @exception org.exolab.castor.xml.MarshalException
  7. * @exception org.exolab.castor.xml.ValidationException
  8. */
  9. public static void marshal(Object object, Node node)
  10. throws MarshalException, ValidationException {
  11. staticMarshal(object, new Marshaller(node));
  12. } // -- marshal

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

  1. /**
  2. * Marshals the given Object as XML using the given DocumentHandler
  3. * to send events to.
  4. *
  5. * @param object The Object to marshal.
  6. * @param handler The DocumentHandler to marshal to.
  7. * @exception org.exolab.castor.xml.MarshalException
  8. * @exception org.exolab.castor.xml.ValidationException
  9. */
  10. public static void marshal(Object object, DocumentHandler handler)
  11. throws MarshalException, ValidationException {
  12. staticMarshal(object, new Marshaller(handler));
  13. } //-- marshal

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

  1. /**
  2. * Marshals the given Object as XML using the given ContentHandler
  3. * to send events to.
  4. *
  5. * @param object The Object to marshal.
  6. * @param handler The ContentHandler to marshal to.
  7. * @exception org.exolab.castor.xml.MarshalException
  8. * @exception org.exolab.castor.xml.ValidationException
  9. */
  10. public static void marshal(Object object, ContentHandler handler)
  11. throws MarshalException, ValidationException, IOException {
  12. staticMarshal(object, new Marshaller(handler));
  13. } //-- marshal

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

  1. public void saveHistory() {
  2. // write back the history to file
  3. try {
  4. FileWriter writer = new FileWriter("queryhistory.xml");
  5. Marshaller marshaller = new Marshaller(writer);
  6. marshaller.setMapping(_mapping);
  7. marshaller.marshal(_qhistory);
  8. } catch (Exception e) {
  9. e.printStackTrace();
  10. }
  11. }

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

  1. /**
  2. * Marshals the given Object as XML using the given writer.
  3. *
  4. * @param object The Object to marshal.
  5. * @param out The writer to marshal to.
  6. * @exception org.exolab.castor.xml.MarshalException
  7. * @exception org.exolab.castor.xml.ValidationException
  8. */
  9. public static void marshal(Object object, Writer out)
  10. throws MarshalException, ValidationException {
  11. try {
  12. staticMarshal(object, new Marshaller(out));
  13. } catch (IOException e) {
  14. throw new MarshalException(e);
  15. }
  16. } // -- marshal

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

  1. /**
  2. * Marshals the given Object as XML using the given writer.
  3. *
  4. * @param object The Object to marshal.
  5. * @param out The writer to marshal to.
  6. * @exception org.exolab.castor.xml.MarshalException
  7. * @exception org.exolab.castor.xml.ValidationException
  8. */
  9. public static void marshal(Object object, Writer out)
  10. throws MarshalException, ValidationException {
  11. try {
  12. staticMarshal(object, new Marshaller(out));
  13. } catch (IOException e) {
  14. throw new MarshalException(e);
  15. }
  16. } //-- marshal

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

  1. /**
  2. * Generates the mapping file.
  3. *
  4. * @param packageName Package name to be generated
  5. * @param sInfo Source Generator current state
  6. * @throws IOException if this Exception occurs while generating the mapping file
  7. */
  8. private void generateMappingFile(final String packageName, final SGStateInfo sInfo)
  9. throws IOException {
  10. String pkg = (packageName != null) ? packageName : "";
  11. MappingRoot mapping = sInfo.getMapping(pkg);
  12. if (mapping == null) {
  13. return;
  14. }
  15. FileWriter writer = new FileWriter(_mappingFilename);
  16. try {
  17. Marshaller marshaller = new Marshaller(writer);
  18. marshaller.setSuppressNamespaces(true);
  19. marshaller.marshal(mapping);
  20. } catch (Exception ex) {
  21. throw new NestedIOException(ex);
  22. } finally {
  23. writer.flush();
  24. writer.close();
  25. }
  26. }

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

  1. /**
  2. * Serializes the mapping to the given writer.
  3. *
  4. * @param writer the Writer to serialize the mapping to
  5. * @throws MappingException if writing the mapping information fails
  6. */
  7. public void write(final Writer writer) throws MappingException {
  8. Marshaller marshal;
  9. MappingRoot mapping;
  10. Enumeration enumeration;
  11. try {
  12. mapping = new MappingRoot();
  13. mapping.setDescription("Castor generated mapping file");
  14. enumeration = _mappings.elements();
  15. while (enumeration.hasMoreElements()) {
  16. mapping.addClassMapping((ClassMapping) enumeration.nextElement());
  17. }
  18. marshal = new Marshaller(writer);
  19. marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
  20. marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
  21. marshal.marshal(mapping);
  22. } catch (Exception except) {
  23. throw new MappingException(except);
  24. }
  25. } // -- write

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

  1. /**
  2. * Serializes the mapping to the given writer.
  3. *
  4. * @param writer
  5. * the Writer to serialize the mapping to
  6. * @throws MappingException if writing the mapping information fails
  7. */
  8. public void write(final Writer writer) throws MappingException {
  9. Marshaller marshal;
  10. MappingRoot mapping;
  11. Enumeration enumeration;
  12. try {
  13. mapping = new MappingRoot();
  14. mapping.setDescription("Castor generated mapping file");
  15. enumeration = _mappings.elements();
  16. while (enumeration.hasMoreElements()) {
  17. mapping.addClassMapping((ClassMapping) enumeration.nextElement());
  18. }
  19. marshal = new Marshaller(writer);
  20. marshal.setNamespaceMapping(null, "http://castor.exolab.org/");
  21. marshal.setNamespaceMapping("cst", "http://castor.exolab.org/");
  22. marshal.marshal(mapping);
  23. } catch (Exception except) {
  24. throw new MappingException(except);
  25. }
  26. } // -- write

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

  1. try {
  2. AxisContentHandler hand = new AxisContentHandler(context);
  3. Marshaller marshaller = new Marshaller(hand);

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

  1. try {
  2. AxisContentHandler hand = new AxisContentHandler(context);
  3. Marshaller marshaller = new Marshaller(hand);

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

  1. try {
  2. AxisContentHandler hand = new AxisContentHandler(context);
  3. Marshaller marshaller = new Marshaller(hand);

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

  1. /**
  2. * Initializes the Castor mapping instance.
  3. * @param mapping a Castor mapping. Shall not be <code>null</code>.
  4. * @throws NullPointerException if <code>mapping</code> is <code>null</code>.
  5. * @throws MappingException an exception indicating an invalid mapping error.
  6. */
  7. private void setMapping(final Mapping mapping) throws MappingException
  8. {
  9. _unmarshaller = new Unmarshaller(mapping); // May throw MappingException.
  10. _unmarshaller.setValidation(false);
  11. _unmarshaller.setIgnoreExtraElements(true);
  12. _marshaller = new Marshaller();
  13. _marshaller.setMapping(mapping); // May throw MappingException.
  14. _marshaller.setValidation(false);
  15. //_marshaller.setDebug(true);
  16. // Specifies whether to support XML namespaces by default. Default is false.
  17. //_marshaller.setProperty("org.exolab.castor.parser.namespaces", "true");
  18. // Specifies whether XML documents (as generated at marshalling) should use indentation or not. Default is false.
  19. //_marshaller.setProperty("org.exolab.castor.indent", "true");
  20. }
  21. }

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

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

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

  1. final ContentHandler handler = xmlWriter;
  2. Marshaller marshaller = new Marshaller(new ContentHandler()

相关文章