[Expat-discuss] use of expat with socket

Thomas J. Clancy tclancy@personity.com
Wed, 25 Jul 2001 08:06:55 -0400


Yes, I agree with this.  But it would be nice to have a handler that
notified you when the end of the xml document had been reached (i.e. the
close tag of the main document element) so that you could take it from there
and come back when you want more, perhaps resetting some flag in the parser
so that it would continue from the point in the buffer where you left off as
if it were starting anew.  The fact that the parser knew there was junk
after the closing document element leads me to believe that the parser knew
when it had reached the end of the document.

But  I do like the idea of embedding the XML into another protocol, and MIME
seems to be a particularly nice way in which to wrap this.

Thanks for your input.  It was most helpful.

tom

------------------------

The problem is that, in the general case, there's no way to
determine if a stream is *supposed* to contain multiple documents.
What is needed is some external way to determine the end of the input;
you can then feed the parser data buffers until the end-of-buffer
function returns true.  You can do this by embedding the chunks of XML
into another protocol; this should not be difficult if you can
determine the size of each XML document in bytes before sending it, so
that each document can be preceeded by the byte-count.  Otherwise,
you'll need a stream encoding that contains explicit end-of-file
markers.

 > simulate this with the xmlwf app by creating a file that contained two
xml
 > documents, expat crapped out with:
 >
 > "junk after document element at line 7."

  No, it didn't "crap out"; it found a real XML error!  It just
depends on how you look at it.


  -Fred

--
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Digital Creations


_______________________________________________
Expat-discuss mailing list
Expat-discuss@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/expat-discuss