users@glassfish.java.net

sjsxp - reading multiple 'docs' through the same socket? possible?

From: <glassfish_at_javadesktop.org>
Date: Tue, 14 Aug 2007 10:20:12 PDT

Just wondering how (if) it's possible to read multiple xml docs through a socket.

Basically everything I try (STAX) gives me an error after reading the first message, as it can't read any more than the first document (or more accurately "Only comments and PIs may appear after the root element")

i.e.
<Message>
<blah/>
<whatever />
</Message>
<Message>
<whatever />
</Message>

dies after the first message...

Essentially I need to keep a socket open, and read fully self contained messages as they are received. Motivation - run an XMLParser of the stream, which will block until we receive a complete XML message (pushing that up for processing), and then sit there waiting for more....

Ideas appreciated!
[Message sent by forum member 'machthree' (machthree)]

http://forums.java.net/jive/thread.jspa?messageID=230853