> From: Devon McCormick <[email protected]> > > does anyone else have experience processing XML using the "sax" add-on? I > recently discovered that a tag like this: > > JPMorgan Chase & Co. > > gives me the value " Co." instead of the full name "JPMorgan Chase & Co.". > > The problem seems to be the ampersand character in "&". If I replace > this string by "&", "&", or "&ersand;", I get assertion > errors "not well-formed (invalid token)" for the first two cases and > "undefined entity" for the third. Replacing it with "amp;" gives no error > and I get the full name "JPMorgan Chase amp; Co.". > > Has anyone else encountered this? Do either of the other two XML add-ons > handle this better? Does anyone know if either of the other two > add-ons is better than sax?
Separating entities is the behavior of SAX. However, entities are stitched automatically for attributes. Automated handling in text nodes would be too specific. For example, it is done in XML DOM. In general, long text nodes can be split between call to "characters" even for non-entities divided text. It is not guaranteed to be a single call for a single stretch of text. The xml/sax addon version 1.0.13 is updated to include examples of entities. See http://www.jsoftware.com/svn/addons/trunk/xml/sax/history.txt Note character accumulation and handling of white space. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
