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.

the problem with this solution is that the xerces parser seems not to
start the actual parsing unless the stream has not been closed.
for the older xerces i have found on the web site:
(http://xml.apache.org/xerces-j/faq-write.html#faq-11)
"The Apache parsers read the entire data stream into a buffer before they
start parsing"
i do believe that xerces2 works the same way but i couldn't find the
solution for that.

my questions are:
- is it somehow possible to tell the SAX parseer to parse more than one
document reading from the same InputStream/Reader without using any
protocol?
- is the assumtion correct that xerces2 does not start the parsing unless
all the data has been read? is there any workaround for that like in
xerces?
bye
                                                        tome


-- 
Taro Rehrl
NorCom Information Technology AG
Stefan-George-Ring 6, 81929 München
Fon +49 - 89 - 939 48 247
Fax +49 - 89 - 939 48 111
mailto:[EMAIL PROTECTED]
http://www.norcom.de/

This email and any attachments contains privileged and confidential
information intended only for the use of the addressee(s). If you are not an
intended recipient of this email, you are hereby notified that any
dissemination, copying or use of information within it is strictly
prohibited. If you received this email in error or without authorisation,
please notify us immediately by reply e-mail and delete the e-mail from your
system. If you need any further assistance, please contact us under
<[EMAIL PROTECTED]>.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to