Java: Writing a DOM to an XML file (formatting issues)

Posted by Vhaerun on Stack Overflow See other posts from Stack Overflow or by Vhaerun
Published on 2008-10-02T09:10:33Z Indexed on 2010/05/31 15:53 UTC
Read the original article Hit count: 129

Filed under:
|
|
|
|

I'm using org.w3c XML API to open an existing XML file. I'm removing some nodes , and I'm adding others instead . The problem is that the new nodes that are added are written one after another , with no newline and no indentation what so ever. While it's true that the XML file is valid , it is very hard for a human to examnine it. Is there anyway to add indentation , or at least a newline after each node ?

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml