xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: Streaming XML Parsing - next document problem
Date Fri, 01 Jun 2001 04:33:33 GMT
James Richardson wrote:
> org.xml.sax.SAXParseException: The root element is required in a well-formed document.

This is normal and according to the spec. Unfortunately, there
is no defined end to an XML document because any number of PIs
and comments may appear after the close of the root element.
And because of buffering in the parser, even if you reset the
parser, there's no way to re-use the buffer -- so the parser
would consume part of the next document which is not what you

If you can control the streams at both ends, then you can use 
the WrappedOutputStream/WrappedInputStream written as a Xerces2 
sample. The sample solves a common socket streaming problem but 
it could also be applied to your particular problem. Check out 
the code with the following command (the code will be extracted 
to the "io" dir):

  cvs checkout -d io -r xerces_j_2 xml-xerces/java/samples/socket

Or use the WebCVS interface. The JavaDoc in the sample should
be enough to figure out how to use it.

Andy Clark * IBM, TRL - Japan * andyc@apache.org

To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org

View raw message