You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Andy Clark <an...@apache.org> on 2001/06/01 06:33:33 UTC
Re: Streaming XML Parsing - next document problem
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
want.
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