Re: parsing a stream of XML over a socket

"Ben Allison" <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Woops, Sorry about that.  My C++ wrapping code passes isFinal == 1
whenever the incoming data and length are 0, but you are correct that
expat handles 0 length just fine.  Sorry for the confusion.

Ben Pirt - another thing to check might be if there is any HTTP reply data
embedded within your socket's stream that you're not accounting for.

> 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
>> [email protected]
>> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>>
>
>
> _______________________________________________
> Expat-discuss mailing list
> [email protected]
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.