[Expat-discuss] unclosed token

Sebastian Pipping webmaster at hartwork.org
Sun Jul 15 03:09:02 CEST 2007


>From a quick look over the code this line seems very odd to me:

   int len = sizeof(buf);      /* xml.c, line 30 */

[buf] is of type [char *] and therefore [len] probably
is 4 on your system. What you want in there is the length
of the string instead. Maybe that is the bug already.

Another thing I noticed is you don't call
XML_ParserFree if XML_Parse fails although you have to.

Also "[t]he string your handler receives is NOT zero
terminated" [1]. That means your character handler will
cause trouble sooner or later:

   printf("DATA=%s \n", s);     /* xml.c, line 16 */

That's all I can do for you right now.



Sebastian


[1] http://www.xml.com/pub/a/1999/09/expat/index.html?page=3#chardatahandler



More information about the Expat-discuss mailing list