[Expat-discuss] use of expat with socket

Thomas J. Clancy tclancy@personity.com
Tue, 24 Jul 2001 13:23:27 -0400


Hey There,

I'm new to this dicussion group and new to expat, so forgive me if this
question has already been asked (I didn't see anything related to this on
the web site).

I want to use expat to replace our own home brewed XML parser.  The problem
is that while I'm getting in data from a socket (the protocol to our product
is in XML), I may get more than one XML document at a time.  When I tried to
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."

Here is the XML I was messing around with:

<?xml version="1.0" ?>
<foo>
  this is a test
  <b>this is</b>
  only a test.
</foo>
<?xml version="1.0" ?>
<foo2>
  this is a test
  <b>this is</b>
  only a test.
</foo2>


I need to detect through some handler that I've reached the end of the
document and to not continue processing.  Then I can put away the remainder
of the buffer and process it later.  Can this be done?


Thomas J. Clancy