[jdom-interest] Comment parsing/outputing issues (bug?)
Jason Hunter
jhunter at collab.net
Thu Feb 22 10:53:16 PST 2001
GB/DEV - Philip Nelson wrote:
>
> > 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.
>
> It looks to me like you may be confusing whitespace in an element and the
> whitespace surrounding tags. There is an option to not preserve whitespace
> *within* elements, otherwise that whitespace is preserved. As for the
> outputting of the tags, this is higly controllable with the Outputter. To
> my knowledge, the exact format of the original whitespace between elements
> is not preserved, nor does the xml spec required that.
Whitespace outside of the root element is not reported by SAX. Thus
when building using SAXBuilder it can't be preserved. This behavior
complies with the XML 1.0 spec.
-jh-
More information about the jdom-interest
mailing list