I have a simple question about Java's XML API and I hope there's a simple answer too:
Lets say that after processing I have the following XML output:
<a>
    <b><c>
    <d> <e> some content
        </e>    </d>
    </c>    </b>
</a>
The structure is correct but whitespaces are all over the place. The question is that how can I prettify the output so that it looks something like this:
<a>
    <b>
        <c> 
            <d>
                <e>some content</e>
            </d>
        </c>
    </b>
</a>
Only catch is that I can't use anything but Java 5's own XML API.
Use Transformer.setOutputProperty(OutputKeys.INDENT, "yes").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With