List of utility methods to do XML Document Save to File
void | saveXML(Document document, String filename) Save an XML file. saveXML(document, new File(filename));
|
void | saveXml(Document dom, String filePath) save Xml saveXml(dom, filePath, false); |
void | saveXml(Document modDoc, String path) save Xml Writer writer = null; try { TransformerFactory tranFactory = TransformerFactory.newInstance(); Transformer aTransformer = tranFactory.newTransformer(); Source src = new DOMSource(modDoc); writer = getFileWriter(path); Result dest = new StreamResult(writer); aTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); ... |
void | saveXMLDocument(Document document, String path) save XML Document saveXMLDocument(document, new File(path));
|
boolean | saveXMLDocument(String fileName, Document doc) Save XML file and saves XML document. File xmlOutputFile = new File(fileName); FileOutputStream fos = null; Transformer transformer; try { fos = new FileOutputStream(xmlOutputFile); TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); ... |
String | saveXmlToStreamWriter(Document doc) save Xml To Stream Writer TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); StringWriter writer = new StringWriter(); transformer.transform(new DOMSource(doc), new StreamResult(writer)); return writer.getBuffer().toString(); |