[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: entity references for special characters and the Sax parse
> > Has anyone else used the Sax parser to parse a given > XML file with the Java method > > <saxParser>.parse(<filename>)? If I call this with a file > that has an ampersand in it (e.g. &), the rest of the > > text within that value on either side of the special > character will be cut off (I verified this by seeing what appears > > in the "characters" method). Has anyone else observed this > behavior? When a SAX parser calles the characters() method in your ContentHandler, it can break up the text node into as many pieces as it likes, calling the method once for each piece. It looks as if Xerces is breaking the text at entity boundaries, which is a perfectly reasonable thing to do. It's the job of your ContentHandler to re-assemble the pieces. There are SAX filters around that do this for you but I can't lay my hands on one immediately (the one in Saxon does too many other things for it to be useful to you). Mike Kay
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|