[jdom-interest] Ampersand question

tsasala at hifusion.com tsasala at hifusion.com
Fri Jul 14 04:20:51 PDT 2000


Jason Hunter wrote:
> 
> >         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?
>

	JDOM.

 
> > 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.

	True.  But this outputs XML and we need HTML in
some cases.  It's my crappy code the does 'work' all the
time.  I just *assumed* that getSerializedForm would 
output the & instead of &.  & is what I think
of as a serialized form, not just &.

> > 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?  :-)

	What's the plan for merging/combining these into a single
code base? Or is there one?

	-Tom



More information about the jdom-interest mailing list