Preserving white space and entity references in DataChannel XJP

Erik James Freed ejfreed at infocanvas.com
Tue Jul 27 17:00:11 BST 1999


I am experiencing some strange behavior with the datachannel XML parser
package (the most recent one).
In my reading of the DOM spec, this is not appropriate behavior, but perhaps
I am missing something.

The behavior is that when I do a 'setPreserveWhiteSpace(true)' before
parsing a document, and the document
contains strings with entity references such as:

    <element1> &lt; fubar &gt; </element1>

when I then do a getText() on element1, what is returned is a
java.lang.String that contains a null (char 0) for each entity reference.

These nulls of course confound the rest of the code I am writing. In side
the DOM tree the entity reference objects are happily holding the
appropriate text representation  i.e. '<' and  '>'.

Turning off white space preservation makes the getText() place appropriate
decoded entity references in the resulting string.

Bug or feature?

erik


Erik James Freed
InfoCanvas Software

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ic.ac.uk/pipermail/xml-dev/attachments/19990727/655dccb9/attachment.htm


More information about the Xml-dev mailing list