I have a socket from
which I'm receiving xml. I need to create a Document object from
this. Once the xml comes in, I need to leave the socket open for other
data to come in. Here's the receiving code:
private Document getDocumentFromStream(InputStream
xmlStream)
{
Document doc = null;
{
Document doc = null;
SAXReader reader = new
SAXReader();
reader.setValidation(false);
reader.setValidation(false);
try
{
doc = reader.read(xmlStream);
}
catch(DocumentException de)
{
System.out.println("error");
{
doc = reader.read(xmlStream);
}
catch(DocumentException de)
{
System.out.println("error");
}
return doc;
}
return doc;
}
Now, the sender
is calling flush() on the stream after it sends the xml, but it
isn't closing the socket. Does the SAXReader know when the end of the xml
data is so that it can construct and return the Document - without me having to
close the stream to signal it that there is no more
data?
