Android Utililty Methods XML Document Save

List of utility methods to do XML Document Save

Description

The list of methods to do XML Document Save are organized into topic(s).

Method

voidWriteXml(OutputStream stream, Document document)
Write Xml
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
Properties outFormat = new Properties();
outFormat.setProperty(OutputKeys.INDENT, "yes");
outFormat.setProperty(OutputKeys.METHOD, "xml");
outFormat.setProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
outFormat.setProperty(OutputKeys.VERSION, "1.0");
outFormat.setProperty(OutputKeys.ENCODING, "UTF-8");
...
booleandoc2XmlFile(Document doc, String filename)
doc Xml File
boolean flag = true;
try {
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    DOMSource source = new DOMSource(doc);
    StreamResult result = new StreamResult(new File(filename));
    transformer.transform(source, result);
} catch (Exception ex) {
...