You have two options:
1. To use a xsl and transform the XML to pretty printed content.
2. If you can use JAXP 1.3, checkout the LoadAndSave API
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/package-summary.html
I believe Xerces 2.9 has a example on how to use the Load&Save API.
HTH
-Prashant
Umesh wrote:
Hi
After lot of search on net, still I am unable to find out a solution
to propertly indent XML document.
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
"0");
The above lines of code seems to work only in a particular situation
where the original XML doc doesn't have any newline or space
characters, i.e. it is one single line.
If the unindented XML doc has any spaces or newline, the program fails
to indent the file completely which one would expect (It indents but
partially, and retains the space, newline in unindented file).
I am using JDK 5.
Is this such a difficult problem to solve? Any help, clues?
Regds
Umesh
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]