Creating XML file with identation
How can I create开发者_JAVA技巧 a XML file that has identation or, at least, line breaks between each tag?
I'm using class XMLSerializer (available in Android) to handle the XML creation.
XMLSerializer serializer = new XMLSerializer();
StringWriter writer = new StringWriter();
serializer.setOutput(writer);
String xmlFileContents = writer.toString();
Then I use the contents of xmlFileContents to create a file, using a BufferedWriter. The file is written, but the XML is not idented, and would like it to be.
Thanks.
already solved: How to indent XML properly using XMLSerializer?
精彩评论