A JAXP
javax.xml.transform.Result implementation that produces
a result on the specified
javax.xml.stream.XMLStreamWriter or
javax.xml.stream.XMLEventWriter .
Please note that you may need to call flush() on the underlying
XMLStreamWriter or XMLEventWriter after the transform is complete.
The fact that JAXBResult derives from SAXResult is an implementation
detail. Thus in general applications are strongly discouraged from
accessing methods defined on SAXResult.
In particular it shall never attempt to call the following methods:
- setHandler
- setLexicalHandler
- setSystemId
Example:
// create a DOMSource
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(...);
Source domSource = new DOMSource(doc);
// create a StAXResult
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
Result staxResult = new StAXResult(writer);
// run the transform
TransformerFactory.newInstance().newTransformer().transform(domSource, staxResult);
author: Ryan.Shoemaker@Sun.COM version: 1.0 |