[xml] Hi, all, about xmlParseChunk's number of calls of characters callback function.


I use xmlCreatePushParserCtxt and xmlParseChunk to parse a stream xml data. And I invoke xmlParseChunk every 4 chars.
    while ((res = readPacket(chars, 4)) > 0) {
        xmlParseChunk(ctxt, chars, res, 0);

And I notice that for example,
<text>very long text data .....  </text>,
if  the content' s length is very long,  xmlParseChunk will invoke characters call back function,  once it parse every   300 characters.

my characters callback function does only print them out. So ,if the content's length is 600. the characters will cause twice time, the first time to print the first 300 characters, and the second time to print the another 300.
 And this behavior will destroy my application.

So How should I do to let the xmlParseChunk only invoke the characters  callback fucntion for just  ONE time, even the the content's length is very long??

Please give me a hand..

Thank you very much.

JinBiao Liu

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