[jdom-interest] attribute values with "&"

bob mcwhirter bob at werken.com
Wed Dec 4 11:43:28 PST 2002


>             <b y="/a?b=c&d=f">a</b>
>  
>         org.jdom.JDOMException: Error on line 1: The reference to entity
> "d" must end with the ';' delimiter.
> 
> I have no control over the input file.  It is being supplied by a
> partner.  I have to parse this file and return a new version with a
> similar attribute value.  Is this a valid XML attribute value?  If so,
> what can I do to parse this file?

Nope.  It's bogus.

The & character introduces an entity which ends with a semi-colon, 
such as &amp; or &apos;.

The single ampersand should be replaced by &amp; to be valid:

	<b y="/a?b=c&ampd=f">

Ugly indeed.  But conformant.

	-bob




More information about the jdom-interest mailing list