XML11EntityScanner

There's a major difference between the XML11EntityScanner and the older XMLEntityScanner that I don't understand, and maybe someone can explain it to me. It is the cause of some strange behavior by the Java SAX parser that I have spent a couple of days understanding. Both classes are in com.sun.org.apache.xerces.internal.impl. The former is called when parsing files in XML version 1.0, and the latter for version 1.1.
Both scanners use a character buffer to hold the chunk of the document they are working on. As they scan and find attribute values, the values are stored as instances of XMLString, which simply point into the buffer with an offset and a length. Obviously if the scanner is in the middle of parsing an element when the buffer is consumed and refilled, some fixup has to occur otherwise the values of the attributes that have been found up to that point will be overwritten by the new buffer content.
Therefore, before the XMLEntityScanner refills the buffer it always notifies listeners so that they can take the fixup actions. Here's a typical piece of code from XMLEntityScanner#peekChar() that is executed to refill the buffer:
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
invokeListeners(0); // tells listeners to cache work in progress
load(0, true); // refills the buffer
} But here's the similar code from XML11EntityScanner#peekChar:
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true);
} Notice that in the second code fragment listeners are not notified, so there is no fixup. In fact XML11EntityScanner doesn't do fixup at all when it reloads the character buffer. As a result, attribute values can be corrupted if the buffer reload happens to fall in the middle of processing an entity. This leads to all kinds of strange XML errors parsing a version 1.1 file that is larger than the buffer size of 8192 characters. Those errors don't happen when parsing a version 1.0 file.
So here's my question -- why is there this difference between XMLEntityScanner and XML11EntityScanner?
Thanks
Alan

Similar Messages

Maybe you are looking for

  • Call to WPG_SESSION API Failed. Error-Code:6550

    Can someone please help me figure out what I may be doing wrong? Using recent downloaded versions of 8i and 9iAS I cannot access Portal30 using IE5 browser. Please see error below. During portal configuration I specified connect string of oracle:1521

  • Opening video (MPEG) files on a Mac

    I recently switched from a PC to IMac. Transferred all my video files to my Mac but each time I try to open one I am told it can not be opened as Quicktime does not recognize the file. Any help appreciated

  • Acrobat 9.5.1 Crashing when printing secure pdf files

    Had this problem with all versions of 9.0 or later, updated in hopes of it fixing the problem. Acrobat just stops working when I try to print secure files. They work fine on machines with older versions of acrobat or reader though. I've tried going t

  • Stopping the music with Lumia 800

    How can the music be stopped? I use Nokia Music, and I previously had synchronised my phone with zune and got some songs from my pc. The problem is, that the music I played won't stop and in the lockscreen it says that there are songs playing and I c

  • How to get pt 9 in paragraph format in sap script

    Hi, I have a requirement to bold the data in output screen in main window,But that paragraph format font size is 9.0 pt if in font tab i select bold radio button then its comming bold in output screen some cases but some cases its not happening.So if