[jdom-interest] predefined entities

Neville Peter p_nevilleuk at yahoo.co.uk
Fri Dec 13 09:06:06 PST 2002

You mention the ethos is to see the actual data rather
than the xml representation. Well, the actual data is
the entity reference & # 39; and this is what I would
like to see (the browser can convert it to what is
required for visual representation). It seems a bit
wasteful to me for the XML parser to convert this to &
only for me to have to convert it back to & # 39; in
order to store it in the database. 
Is it JDOM that is causing this to happen or the
underlying parser? 
Do you know if there any parsers that behave as I
would like?

Thanks for you comments.

 --- "Robert (Jamie) Munro" <rjmunro at arjam.net> wrote:
> ----- Original Message -----
> From: "Neville Peter" <p_nevilleuk at yahoo.co.uk>
> To: <jdom-interest at jdom.org>
> Sent: Friday, December 13, 2002 1:34 PM
> Subject: [jdom-interest] predefined entities
> > Hello,
> >
> > I have seen a few threads on this subject, but no
> > answers to my problem:
> >
> > I am using SAXBuilder to construct my Document.
> The
> > XML file has entity references in some attributes.
> For
> > example, <a val1="X&Y"/>.  When I use retrieve
> > this element and get the attribute value I get
> "X&Y"
> > as the value.
> > What I would like is "X&Y" ie. as it is in the
> > file. This is because I want to store this value
> in my
> > database without having to call any conversion
> > methods.
> >
> > I have tried using crimson, xerces 2.1.1 etc and
> > setting setExpandEntities to false and also
> creating
> > my own EntityResolver. But cannot get the
> > functionality I require above.
> >
> > Any ideas?
> What you want goes against the spirit of JDOM. The
> whole ethos is that you
> always see the actual data, rather than the XML
> representation of the data.
> The only exception to this very important principle
> is XMLOutputter. If you
> want to store it in a database in XML format, then
> you need to use
> XMLOutputter on the particular element. If you want
> to covert strings into
> an XML-like representaion (ie. replacing the chars
> &<>" and anything that
> can't be represented in the current data set with
> &[something];, you need to
> do that yourself.
> Robert Munro

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

More information about the jdom-interest mailing list