[jdom-interest] predefined entities

Neville Peter p_nevilleuk at yahoo.co.uk
Fri Dec 13 08:54:24 PST 2002


Thanks Robert. 
The XMLOutputter does output the element as required
with & # 38; not being converted to &
But, I believe that it does not have a method for
outputting the contents of an attribute or even the
attribute itself.
There is a protected method for outputting a list of
attributes, but why isn't there an
XMLOutputter.outputString(Attribute attribute)?

Regards,
Peter





 --- "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
> XML
> > 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
http://uk.my.yahoo.com



More information about the jdom-interest mailing list