xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmad Morad <mo...@ibiza.db.informatik.uni-kassel.de>
Subject DocumentBuilder.parse()
Date Thu, 30 Nov 2000 12:15:28 GMT
Hello xalan's, 

With the following code I read an XML-Document from an «InputSource» <from>
and store it in a «Document» object using the  DocumentBuilder.parse()
method. However the InputSource <from> is the InputStream of a socket.
the parse method close the stream after reading the document! This well
close the connection to the server !

The only way I know to avoid that is to read the document in a string and to
call the parse method to read the string in a dom tree. But this sulution
is very slow! 

how can I avoid the parser from closing the stream after the parse process
has been finished ?

Than you
Morad Ahmad 

code :
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
Document doc = docBuilder.parse(from); // after that from well be closed
return doc;


View raw message