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

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

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

Marshaller.setContentHandler介绍

[英]To set the content handler which is used as destination at marshalling.
[中]设置编组时用作目标的内容处理程序。

代码示例

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

/**
 * Creates a new {@link Marshaller} with the given SAX {@link ContentHandler}.
 *
 * @param contentHandler the {@link ContentHandler} to "marshal" to.
 * @throws IllegalArgumentException if the gievn {@link ContentHandler} is null
 * @deprecate Please use {@link XMLContext#createMarshaller()} and
 *            {@link Marshaller#setContentHandler(ContentHandler)} instead
 * 
 * @see {@link XMLContext#createMarshaller()}
 * @see {@link Marshaller#setContentHandler(ContentHandler)}
 * @see XMLContext
 * 
 **/
public Marshaller(final ContentHandler contentHandler) {
 super(null);
 checkNotNull(contentHandler, "The given 'org.sax.ContentHandler' is null.");
 setContentHandler(contentHandler);
}

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

/**
 * Sets the given SAX {@link DocumentHandler} to 'marshal' into.
 *
 * @param handler the SAX {@link DocumentHandler} to "marshal" to.
 *
 * @throws IllegalArgumentException if the given {@link DocumentHandler} is null
 **/
public void setDocumentHandler(final DocumentHandler handler) {
 checkNotNull(handler, "The given 'org.sax.DocumentHandler' instance is null.");
 setContentHandler(new DocumentHandlerAdapter(handler));
}

代码示例来源:origin: org.springframework.ws/spring-oxm

protected final void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
    throws XmlMappingException {
  Marshaller marshaller = xmlContext.createMarshaller();
  marshaller.setContentHandler(contentHandler);
  marshal(graph, marshaller);
}

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

/**
 * Sets the {@link XMLStreamWriter} to use.
 *
 * @param xmlStreamWriter the {@link XMLStreamWriter} instance to use
 *
 * @throws IllegalArgumentException if the xmlStreamWriter is null
 *
 * @since 1.3.3
 */
public void setXmlStreamWriter(XMLStreamWriter xmlStreamWriter) {
 checkNotNull(xmlStreamWriter, "The given 'java.xml.stream.XMLStreamWriter' instance is null.");
 setContentHandler(new StaxStreamHandler(xmlStreamWriter));
}

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

/**
 * Sets the {@link XMLEventWriter} to use.
 *
 * @param xmlEventWriter the {@link XMLEventWriter} instance to use
 *
 * @throws IllegalArgumentException if the xmlEventReader is null
 *
 * @since 1.3.3
 */
public void setXmlEventWriter(XMLEventWriter xmlEventWriter) {
 checkNotNull(xmlEventWriter, "The given 'java.xml.stream.XMLEventWriter' instance is null.");
 setContentHandler(new StaxEventHandler(xmlEventWriter));
}

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

/**
 * Creates a new {@link Marshaller} with the given SAX {@link DocumentHandler}.
 *
 * @param handler the SAX {@link DocumentHandler} to "marshal" to.
 *
 * @throws IllegalArgumentException if the given {@link DocumentHandler} is null
 * @deprecate Please use {@link XMLContext#createMarshaller()} and
 *            {@link Marshaller#setDocumentHandler(DocumentHandler)} instead
 * 
 * @see {@link XMLContext#createMarshaller()}
 * @see {@link Marshaller#setDocumentHandler(DocumentHandler)}
 * @see XMLContext
 * 
 **/
public Marshaller(final DocumentHandler handler) {
 super(null);
 checkNotNull(handler, "The given 'org.sax.DocumentHandler' instance is null.");
 setContentHandler(new DocumentHandlerAdapter(handler));
}

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

/**
 * Sets the W3C {@link Node} instance to marshal to.
 *
 * @param node the DOM {@link Node} to marshal into.
 *
 * @throws IllegalArgumentException if node is null
 **/
public void setNode(final Node node) {
 checkNotNull(node, "The given 'org.w3c.dom.Node' instance is null.");
 setContentHandler(new DocumentHandlerAdapter(new SAX2DOMHandler(node)));
}

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

setContentHandler(saxResult.getHandler());
return;

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

/**
 * Creates a new {@link Marshaller} for the given DOM {@link Node}.
 *
 * @param node the DOM {@link Node} to marshal into.
 *
 * @throws IllegalArgumentException if node is null
 *
 * @deprecate Please use {@link XMLContext#createMarshaller()} and
 *            {@link Marshaller#setNode(Node)} instead
 * 
 * @see {@link XMLContext#createMarshaller()}
 * @see {@link Marshaller#setNode(Node)}
 * @see XMLContext
 **/
public Marshaller(final Node node) {
 super(null);
 checkNotNull(node, "The given 'org.w3c.dom.Node' instance is null.");
 setContentHandler(new DocumentHandlerAdapter(new SAX2DOMHandler(node)));
}

相关文章