Hi All,
I wish to thank all the people for the replies and suggestions about reading multiple XML from a socket (see thread: http://mail-archives.apache.org/mod_mbox/xerces-j-users/200602.mbox/[EMAIL PROTECTED])
Unfortunately no suggestion was useful for our case in which:
1- Server and protocol **cannot be changed**. Any solution that affects the protocol (markers, parent root tag, etc.) is *not applicable* to our case.
2- XML messages shall be considered finished when the root tag is closed; solutions that wait for the next <?xml to consider the XML message finished are not applicable beacuse the server would send XML messages with some time delay between them
The funny thing is that the solution would be exactly the same as in FAQ-11 in Xerces1 (http://xerces.apache.org/xerces-j/faq-write.html#faq-11 ).
I wish to thank all the people for the replies and suggestions about reading multiple XML from a socket (see thread: http://mail-archives.apache.org/mod_mbox/xerces-j-users/200602.mbox/[EMAIL PROTECTED])
Unfortunately no suggestion was useful for our case in which:
1- Server and protocol **cannot be changed**. Any solution that affects the protocol (markers, parent root tag, etc.) is *not applicable* to our case.
2- XML messages shall be considered finished when the root tag is closed; solutions that wait for the next <?xml to consider the XML message finished are not applicable beacuse the server would send XML messages with some time delay between them
The funny thing is that the solution would be exactly the same as in FAQ-11 in Xerces1 (http://xerces.apache.org/xerces-j/faq-write.html#faq-11 ).
The fact that a solution to the problem was given as a FAQ means that many people were facing the same problem we have.
FAQ-11 was suggesting to solve in 3 steps:
STEP-1. Avoid the buffering of the parser by subclassing org.apache.xerces.readers.DefaultReaderFactory
STEP-2. Terminate the SAX parse when the root tag is closed by throwing a SAXException
STEP-3. Preventing the parser from closing the socket -> subclass BufferedReader to provide an empty close method
STEP-1. Avoid the buffering of the parser by subclassing org.apache.xerces.readers.DefaultReaderFactory
STEP-2. Terminate the SAX parse when the root tag is closed by throwing a SAXException
STEP-3. Preventing the parser from closing the socket -> subclass BufferedReader to provide an empty close method
FAQ-11 was giving exactly the same solution we are looking for.
But unfortunately STEP-1 is not applicable to Xerces2, as the internal class org.apache.xerces.readers.DefaultReaderFactory has been moved.
Is there a way to avoid the buffering of the parser in Xerces2 ??
Many thanks for your help,
Massimo
Is there a way to avoid the buffering of the parser in Xerces2 ??
Many thanks for your help,
Massimo
