You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Wong Kok Wai <wo...@pacific.net.sg> on 2000/02/20 09:58:48 UTC

Xerces-J: COMMENT node messes up pretty printing

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>