When a Comment node is added to the DOM and serialised to a file, the
indentation is messed up. For example, using the Test2.java attached,
the result is:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <ele1>
        <ele2 attr1="attrval1"/><!-- This is a comment --></ele1>
</root>

I would expect the output be like:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <ele1>
        <ele2 attr1="attrval1"/>
        <!-- This is a comment -->
    </ele1>
</root>

Removing the comment node gives:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <ele1>
        <ele2 attr1="attrval1"/>
    </ele1>
</root>


Attachment: Test2.java
Description: application/unknown-content-type-jbuilder.javafile

Reply via email to