[Expat-discuss] Beginner problem
Wed, 11 Sep 2002 16:56:13 -0600 (MDT)
If you are now setting isFinal to 0 on all but the last buffer, and non-zero on
the last buffer, then I would say to make sure that the length element that you
are sending to XML_ParseBuffer() does not include the final NULL character in
the string, as this would not be a valid XML character. In other words you want
to use strlen() for the length of the string, not sizeof() for the number of
bytes, which is what fstat() is giving you. What bothers me is that I would
think you would get this problem on every buffer, not just the last, unless
you're reading in the entire document into a single buffer.
- Josh Martin
> ok. I get the error regardless of isFinal being 0 or 1.
> Karl Waclawek wrote:
> >>Hi all,
> >>I am having a weird problem I can't figure out. Much help would be
> >>I have some code - I always get a "not well formed (invalid token)"
> >>error at the
> >>end of the file. I can't figure it out. I KNOW the document is well
> >> if (readTextFile(buff, doc, sz) <= 0) //Read the xml file
> >> return NULL;
> >> if (! XML_ParseBuffer(parser, sz, 0)) //Parse the doc
> >If you only use one buffer, you need to set the isFinal argument to <> 0,
> >otherwise the parser expects more data.