List of utility methods to do XML Document to Stream
void | writeDocument(Document doc, Transformer transformer, OutputStream out) write xml document to output stream Source src = new DOMSource(doc); Result dest = new StreamResult(out); transformer.transform(src, dest); |
void | writeDocument(Document document, OutputStream documentOutputStream) Write the DOM Document to specified OutputStream Result result = new StreamResult(documentOutputStream); Transformer xformer = TransformerFactory.newInstance().newTransformer(); Source source = new DOMSource(document); xformer.transform(source, result); |
void | writeDocument(Document document, OutputStream os) writeDocument streams out given document to given output stream TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(os); transformer.transform(source, result); |
void | writeDocument(Document document, OutputStream outputStream) write Document defaultTransformer.transform(new DOMSource(document), new StreamResult(outputStream)); |
void | writeDocument(OutputStream iStream, Element iElement) write Document TransformerFactory lTransformFactory = TransformerFactory.newInstance(); Transformer lTransformer = lTransformFactory.newTransformer(); DOMSource lSource = new DOMSource(iElement); StreamResult lStreamResult = new StreamResult(iStream); lTransformer.transform(lSource, lStreamResult); |
void | writeDocument(OutputStream os, Document document) Writes the given document to the given output stream. getImplementation();
DOMImplementationLS implLS = (DOMImplementationLS) impl;
LSOutput output = implLS.createLSOutput();
output.setByteStream(os);
LSSerializer serializer = implLS.createLSSerializer();
serializer.getDomConfig().setParameter("format-pretty-print", true);
serializer.write(document, output);
|
void | writeDocument(OutputStream os, Node node) Writes the given node to the given output stream. getImplementation();
DOMImplementationLS implLS = (DOMImplementationLS) impl;
LSOutput output = implLS.createLSOutput();
output.setByteStream(os);
LSSerializer serializer = implLS.createLSSerializer();
serializer.getDomConfig().setParameter("format-pretty-print", true);
serializer.write(node, output);
|
void | writeDocument(OutputStream stream, Document document) write Document Source input = new DOMSource(document); StreamResult output = new StreamResult(stream); TransformerFactory xFormFactory = TransformerFactory.newInstance(); Transformer idTransform = xFormFactory.newTransformer(); idTransform.transform(input, output); |
void | writeDOMDocumentToStream(Document doc, OutputStream stream) Serialises a DOM document to a stream. DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(stream); getXMLTransformer().transform(source, result); |
void | writeOutDocument(OutputStream os, Document doc) write Out Document DOMSource source = new DOMSource(doc); StreamResult sResult = new StreamResult(os); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer t = tFactory.newTransformer(); t.setOutputProperty(OutputKeys.ENCODING, "utf-8"); t.setOutputProperty(OutputKeys.METHOD, "xml"); t.setOutputProperty(OutputKeys.INDENT, "yes"); t.transform(source, sResult); ... |