Gentlemen, I have XML files that look like this:
bla
anything &
If they dont contain an ampersand I can parse them to TXMLObjects and insert them in my Tamino DB, else I retrieve an Exception:<BR>org.jdom.JDOMException: Error on line 1: The entity name must immediately follow the '&' in the entity reference.<BR> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:407)<BR> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:499)<BR> <BR>The Exception is caused in the following JavaCode:<BR><BR>Document document = saxBuilder.build( new StringReader(getXmlStringBuffer().toString()) ); <BR><BR>I read Bill Leeney
s post from 08 Nov 2002 14:19, however I need further Instructions.
Thank you
This isn’t really the same issue as the post you refer to. The ampersand character is not valid in xml element content and needs to be escaped. See the following quote from w3c:
The ampersand character (&) and the left angle bracket (<) may appear in their literal
form only when used as markup delimiters, or within a comment, a processing instruction, or a
CDATA section. If they are needed elsewhere, they must be escaped using either numeric character
references or the strings "&" and "<"
Unescaped ampersands are assumed to be the start of an entity name, and hence the text of your error.
HTH