Parsing XML From a Socket InputStream using Xerces 1.4.4
Posted on 2004-04-04
I'm trying to figure out the problem with using Xerces 1.4.4 to parse XML data that has been passed through a socket... I have no idea whats going wrong. Here's the code used:
InputStream in = socket.getInputStream();
InputStreamReader contentReader = new InputStreamReader(content);
DOMParser domparser = new DOMParser();
inputsource = new InputSource(contentReader);
//Process the DOM Here
The following code works if I manually take the data from the InputStream and turn it to a String, then pass a StringReader over
to the DOMParser.
I also tried using a FileInputStream (to experiment reading from an XML File) instead of using a Socket InputStream by
"InputStream in = socket.getInputStream();"
"FileInputStream in = new FileInputStream("testXML.xml");"
and the parser works...
So where could the problem possibly lie?
Thanks in advance!