At 16.27 19/12/2003 -0600, Curtis Leach wrote:
Interesting,

So to fix my entry, I'd do the following:
<cust_name>CABLE &amp; WIRELESS</cust_name>

But this breaks it into 2 calls to characters()
  startElement (cust_name)
  characters (CABLE , 6)
  characters (& WIRELESS, 10)
  endElement (cust_name)

Is there any way to fix it so it only makes 1 call to characters()?

No; the characters() call is allowed by the SAX specs to be called multiple times. This could also occur if you had a text node 100Kb big, as the parser works on internal buffers of less than 50Kb...


Also what is the escape sequence for "<" & ">" ?

&gt; and &lt;
When inside attribute values, also " and ' need to be escaped, using &quot; and &apos;


Alberto





Curtis

-----Original Message-----
From: Alberto Massari [mailto:[EMAIL PROTECTED]
Sent: Friday, December 19, 2003 4:10 PM
To: [EMAIL PROTECTED]
Subject: Re: Unexpected errors in SAX2 parser Xerces C++ v2.3.0


At 15.53 19/12/2003 -0600, Curtis Leach wrote: >In parsing some XML documents, I'm getting the following SAXParseException >error when parsing my XML document. > >"Expected entity name for reference" > >After some research I tracked it down to the following tags. > <cust_name>CABLE & WIRELESS</cust_name> > >My trace showed: > startElement (cust_name) > characters (CABLE , 6) >The exception is thrown by Xercesc before control is returned on the next >call. > >My question is: is the "&" a special char in XML ? If so, where can I find >a list of special chars in XML? And how do I escape them so that they are >allowed in an XML document.

Yes, "&" is a special character (as well as "<" and ">"); it needs to be
escaped using the string "&amp;"

Alberto



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to