[Expat-discuss] parsing a stream of XML over a socket

rolf at pointsman.de rolf at pointsman.de
Sun Jun 4 19:47:18 CEST 2006


On  4 Jun, Ben Allison wrote:
> Parsing a stream chunks at a time works perfectly fine.  Just make sure
> you never pass a zero-sized chunk of data, as this indicates and
> end-of-file to Expat.

No. It's only the isFinal argument of XML_Parse() and XML_ParseBuffer(),
which inidicates, if the current chunk of data is the final one or
not. Empty chunks (len == 0) are OK, even with isFinal == 0.

rolf


> Also, are you sure that your XML is valid?
> 
> -Ben Allison
> 
>> Hi All,
>> I have just started trying to work with expat so that I can send out
>> a stream of XML data over a socket so that a client can display the
>> results. I have already written the server in java and am currently
>> coding up a client in C which is where expat comes in. The problem I
>> am having is that C reads the socket in chunks at a time and so when
>> I pass a chunk to expat it will often throw an error. What is the
>> best approach for this problem? Is there a way to tell expat to keep
>> parsing a stream of XML? Is expat even the right parser to use?
>> Any help is greatly appreciated.
>> Thanks,
>> Ben Pirt
> 
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
> 




More information about the Expat-discuss mailing list