GNOME Bugzilla – Bug 167134
Python bindings: registerErrorHandler broken?
Last modified: 2009-08-15 18:40:50 UTC
Please describe the problem: It appears like registerErrorHandler or related doesn't work as documented on xmlsoft.org's validate.py example. The registered function appears to never be called. Example code and discussion can be found at: http://mail.gnome.org/archives/xml/2005-February/msg00001.html Cheers, Frans Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
You misunderstood validity and well-formedness ! IsValid means there was a *validity* errror raised. Your input is not well formed, a different, fatal kind of error. Now w.r.t. the error message I don't get it on the current version: paphio:~/XML -> cat tst.py import libxml2 #deactivate error messages from the validation def noerr(ctx, str): pass libxml2.registerErrorHandler(noerr, None) ctxt = libxml2.createFileParserCtxt("invalid.xml") ctxt.validate(1) ctxt.parseDocument() doc = ctxt.doc() valid = ctxt.isValid() doc.freeDoc() if valid != 0: print "validity check failed" paphio:~/XML -> cat invalid.xml <?xml version="1.0" ?> <xml> <foo /> <!-- <thiasda asd asd ><>>>>>> tihs is invalid XML --> </xml> paphio:~/XML -> python tst.py paphio:~/XML -> I assume this was fixed sometime ago, Daniel
This should be closed by release of libxml2-2.6.21, thanks, Daniel