[Expat-discuss] Re: Beginner Problem
Thu, 19 Sep 2002 12:12:58 -0600 (MDT)
> From: "Karl Waclawek" <email@example.com>
> I am not a Unix guy, but I have seen this a few times
> in Expat code I have encountered, causing a problem
> almost every time..
> Why is fread actually returning a different value than fstat?
In my experience this problem (invalid token error at end) is caused by sending
the size of the buffer in bytes to XML_Parse() instead of the length of the
string. This causes the terminating NULL in the string/buffer to be parsed by
Expat, which always seems to confuse it.
Now, would it be possible/desirable to hack the expat release so that it will
ignore any single terminating NULL character that it does not understand? Or, if
not that, then maybe put an explicit warning in the documentation (near
XML_Parse/XML_ParseBuffer) about this behavior?
I don't see any problems with the hack approach, as long as the character is
only ignored when it causes a problem, so that any intentional nulls aren't
- Josh Martin