Hi,

I'm using Xerces (currently 1.4) to parse XML sent over a socket
connection.  I've written a BinSockInputStream class which is derived
from InputStream to feed the data into the parser.  In order to send
more than one XML "file" over the same socket connection, I send a
special illegal character (Ctrl-L) at the end of each XML "file" which
is recognized (and removed) by BinSockInputStream.

Everything works beautifully besides one thing: the parser always
calls BinSockInputStream::readBytes a second time after receiving the
complete XML data. Example: if I get an XML which is shorter than the size
of the buffer passed to readBytes, I fill the buffer with the complete
XML file.  Then, the parse function calls readBytes again.  At this
point, I have no more data to return.

My first implementation just tried to read more data from the socket
(and thus was blocked if this was the last XML "file").  Now I have a
stupid flag in BinSockInputStream which just retuns 0 on every second
invocation.  This seems to work, but is of course a gross hack.

So finally my question: -)
  What do I have to do to tell the parser that it has got everything
  and should not try to read more characters?

--nk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to