[jdom-interest] Ampersand question

Jason Hunter jhunter at collab.net
Wed Jul 12 19:03:34 PDT 2000

>         When I output the DOM document, I get pretty much the same
> thing back (within reasonable whitespace limits).  

Do you mean a JDOM document or DOM document?

> However, when I
> output the document by calling getMixedContent and iterating
> over the content, the ampersand comes out as a single '&'.

Iterating over getMixedContent() you get raw string values back.  And
the raw string value is an ampersand.  Only when you write to an XML
file does it need to be converted.

> Ultimately this will blow up when I parse it again.  

Not if you write it out using the XMLOutputter.

> output the content by using getSerializedForm on all
> the different object types (elements, entities, comments, etc).
>         Shouldn't the getSerializedForm output & instead
> of &?  The outputter class does special processing to output
> <, >, & as their escaped equivalents.  Am I missing something
> here?

Yes, but there are 3 versions of that method right now (beta4, CVS,
Elliotte's web page) so which one has the problem?  :-)


More information about the jdom-interest mailing list