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



On Mon, Jan 18, 2010 at 10:21:06AM +0800, Liu bbskill wrote:
Hi,all

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??

  Sorry there is internal buffering for obvious performance issues,
libxml2 can't do what you ask.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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