[jdom-interest] Character reference representation

Alastair Rodgers alastair.rodgers at PHOCIS.COM
Thu Dec 20 11:58:21 PST 2001

Thanks, I suspected that was probably the case. Guess I'll just have to live with it. 

> -----Original Message-----
> From: Jason Hunter [mailto:jhunter at apache.org]
> Sent: 20 December 2001 19:35
> To: Alastair Rodgers
> Cc: 'jdom-interest at jdom.org'
> Subject: Re: [jdom-interest] Character reference representation
> > This is fine for an app to interpret, but for a person its not clear
> > just from looking at the doc which whitespace is relevant and which 
> > isn't.
> Even though your char entity helps a person reading the text 
> file know,
> when a person receives the XML programmatically (using SAX, DOM, or
> JDOM) they won't be able to tell because that char entity would be
> converted to a normal \n.  So you may want to rethink your model for
> indicating what whitespace is important, and use xml:space or 
> some such
> indicator instead.
> > Is there any straightforward way to force such chars to be 
> > represented by their escaped character reference form, i.e. 
> > force it to write 
 on output?
> The model is to subclass XMLOutputter and override the 
> methods that are
> responsible for the escaping.  Of course, you'll have a hard time
> knowing which newlines to escape, because the SAX parser converts the
> char entity to its \n char on read, so JDOM never sees the 
> entity and it
> will look like any other newline.
> -jh-

More information about the jdom-interest mailing list