Parsing XML documents received from a socket
2004-08-02 11:01:28 GMT
Dear ML, I'm asking this on behalf of a colleague of mine. But I'm also interested in possible answers. We don't want to use a different parser. Here's the request: hello i have the following problematic. i'm reading several xml documents after each other from a network socket and i would like to process them with a sax parser. problem is: documents can have only one root node and the parser does not know where to stop the processing of the data read from the incoming stream and i have a parsing problem. there is a solution for that on the web site: (http://xml.apache.org/xerces2-j/samples-socket.html) but since i cannot change the protocol i cannot use this solution. with the following restrictions: - xml declarations are omitted(this is the situation in my case) - same encoding is used for all documents my solution would be: i'm creating a special InputStream that would encapsulate all the documents read from the socket into one big virtual document. <?xml version="1.0" ?><virtualDocument>[here are the xml documents read from the network]</virtualDocument> and with a special ContentHandler that would emulate startDocument and endDocument methods for the real ContentHandler implementation.(Continue reading)
RSS Feed