[xml] bug in pushparser implementation

hallo daniel,
hallo all,

after being active this weekend, i found a 'funny' bug in the push parser
implementation. i don't want to mention that the error messages are not 
too usefull, but the pushparser is not able detect some trailing junk at the
end of a document. more detailed the push parser will not report an error,
if there is only a single character after the root element was closed.

the following lines will show the problem with maximum simplicity:

  xmlParseChunk(ctxt, "<A/>", 4, 0);
  xmlParseChunk(ctxt, "X", 1, 0);
  xmlParseChunk(ctxt, "", 0, 1);/* finish the parse */

  if ( ctxt->errNo == 0 ) {
      printf( "ouch!\n" );

of course '<A/>X' is *not* a well formed XML document and so the document
returned by the parser is only '<A/>'. while this is ok if one likes to 
repair a document, not reporting an error at all, is definitly wrong. 

because of this i would like to provide a tiny patch, that fixes this 
problem. i am not shure if this is the correct way, but at least it fixes the

christian glahn

Attachment: push_parser_patch.diff
Description: Text document

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]