[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SAXChunkConsumer.processChunk()



Hi again :)

The SAXChunkConsumer is used by ozone's XML support to
convert the binary representation of an XML document back
into a DOM tree or into SAX events.

The method 'processChunk' an array of bytes, builds a stream
from it and reads from this stream. While handling a COMMENT-
event, the following code is executed:

case CXMLContentHandler.COMMENT:
    if (this.lexicalHandler != null) {
        char[] comment = cxmlInput.readChars();
        this.lexicalHandler.comment(comment, 0, comment.length);
    }
    break;

This works fine for storing documents in ozone or using the
SAXChunkConsumer to construct a DOM tree, because then
the lexicalHandler will always be set (to the SAXChunkConsumer
itself).
If using the SAXChunkConsumer to create SAX events the
lexicalHandler may be null and so the characters of the comment
are not read from the stream. The SAXChunkConsumer tries
to read the next event from the stream but recieves the first
character of the comment. The following code corrects this:

case CXMLContentHandler.COMMENT:
    char[] comment = cxmlInput.readChars();
    if (this.lexicalHandler != null) {
        this.lexicalHandler.comment(comment, 0, comment.length);
    }
    break;

Now the characters are always read from the stream.

Bye...

Wolfgang

----------------------------------------------------------------------
Post a message:         mailto:ozone-users@ozone-db.org
Unsubscribe:            mailto:ozone-users-request@ozone-db.org?body=unsubscribe
Contact administrator:  mailto:ozone-users-owner@ozone-db.org
Read archived messages: http://www.ozone-db.org/
----------------------------------------------------------------------