You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by afarah <af...@earthlink.net> on 2003/12/02 23:31:45 UTC

parse multiple documents from stream....

I want to parse multiple documents from a socket stream. The xercesc SAXParser issues a "fatalError" when it finds anything past the end of the first root node in its buffer.

I have written an extension to BinInputStream to use a socket. This stream does a non-blocking "recv" and simply returns 0 when the "recv" thinks there is no data to read. The SAXParser is happy with this unless my BinInputStream returns more than one document in the "readBytes" call.

Is there a way to tell the parser to either a) parse multiple documents inside the same buffer from a "readBytes" call
or b) to tolerate multiple root nodes and just plow ahead?

thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


RE: parse multiple documents from stream....

Posted by Dean Roddey <dr...@charmedquark.com>.
Your input stream has to lie and say the source ended, but keep up with the
fact that there is more and then start providing the next document on the
next parse call. You cannot parse multiple documents in one parse call, but
if you keep calling parse and the input stream keeps feeding it document
chunks, the parser doesn't know or care that it came from the same source as
a long stream or not.

-------------------------------------
Dean Roddey
The Charmed Quark Controller
droddey@charmedquark.com
www.charmedquark.com
 


-----Original Message-----
From: afarah [mailto:afarah@earthlink.net] 
Sent: Tuesday, December 02, 2003 2:32 PM
To: xerces-c-dev@xml.apache.org
Subject: parse multiple documents from stream....


I want to parse multiple documents from a socket stream. The xercesc
SAXParser issues a "fatalError" when it finds anything past the end of the
first root node in its buffer.

I have written an extension to BinInputStream to use a socket. This stream
does a non-blocking "recv" and simply returns 0 when the "recv" thinks there
is no data to read. The SAXParser is happy with this unless my
BinInputStream returns more than one document in the "readBytes" call.

Is there a way to tell the parser to either a) parse multiple documents
inside the same buffer from a "readBytes" call or b) to tolerate multiple
root nodes and just plow ahead?

thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org