[jdom-interest] Comment parsing/outputing issues (bug?)

Sylvester,Peter A. peters at mitre.org
Thu Feb 22 06:40:01 PST 2001


It seems that newlines are not preserved in XML documents when parsed by
JDOM and then output.  I thought that all text in an XML document was
considered significant, including whitespace.  This is using the
default, included (Xerces) SAX parser with JDOM-B6.

As an example, the following input:
--------------------------------------------
<!-- comment1 -->

<!-- comment2 -->

<!--
comment3
-->

<!--
comment4
-->

<sometag>
</sometag>

Gets output as:
--------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- comment1 --><!-- comment2 --><!--
comment3
--><!--
comment4
--><sometag>
</sometag>



More information about the jdom-interest mailing list