You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Ronald J Mann - SunSoft Engineering <ro...@pawnee.East.Sun.COM> on 2001/02/06 12:37:00 UTC

Stream Disconnect detection

Hello, 

I've been trying to implement as small protocol using XML 
and the SAX parser across a continuously open stream.  I 
followed the suggestions in the FAQ:
(http://xml.apache.org/xerces-j/faq-write.html#faq-11) 
and all is well with one exception (actually a bunch of them ;-) ).  
When the stream is broken by the sender, the parser throws 
a "Parsing Exception:  org.xml.sax.SAXParseException:
The root element is required in a well formed document" and 
I hit the overriden close call.  The problem is how do I
distinguish between a bad doc coming across and a broken 
connection?  As I don't recognize the connection is down, 
I wind up reentering the parser and immediately blowing 
back out to the close call (infinitely) as opposed to closing 
the socket and exiting.  Any suggestions?

Thanks in advance, 

=Ron Mann=