开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜