[Expat-discuss] expat beginner:how to parse longer doc with
ParseBuffer
Jobbágy Zsigmond
zjobbagy26 at yahoo.co.nz
Mon Feb 28 00:09:47 CET 2005
Hi,
I'm rather new to expat, trying to figure out how it works. Here is what
I don't understand:
When calling XML_Parse(...), or XML_ParseBuffer for longer documents,
there is the IsFinal parameter, which tells
expat if there is any more of the document. I couldn't find anything in
the documentation about whether the
pieces should end and start so, that they remain "well-formed" (is it
possible at all?). When I feed in the document
with a certain bufsize, I get an error message right after the start of
parsing the second piece.
Here is a test output showing what's in the buffer along the calls:
buffer starts as:
<?xml version="1.0" encoding="UTF-8" sta
buffer ends as:
ent19>
<element20>SZNY</elem
buffered: 1000
element1 //list of elements, the output of the program
element2
element3
element4
element5
...
element19
element20 // first piece ended, next buffered
buffer starts as:
ent20>
<element21>742</element21>
buffer ends as:
>
</element42>
<element43>
buffered: 1000
Parse error at line 198:
not well-formed (invalid token)
In this example, I show, that the last closing element was truncated
when buffered, but it was listed before the second buffering...
Can I expect expat to treat this (and so I made something wrong
somewhere else), or some other trick is needed to avoid this behaviour?
My document is well-formed (as I checked with Firefox). I guess there
must be a very simple solution for this, or I just thought expat would
be easy and it isn't...
The code is what I found in elements.c + some of mine.
Thanks
Zsigmond
More information about the Expat-discuss
mailing list