Robert Kern wrote:
I'm in the process of testing hooks for reporting libxml2's so-called "structured errors" in lxml. Among other things, I want to get a more diagnostic message when a document fails to validate against a RelaxNG schema.
I ran across a problem where an invalid document will fail the validation the first time but succeed when the validation is repeated. I haven't been able to isolate a small test case, unfortunately; my attempts at simplification give the expected results.
I am on OS X 10.4 using lxml pristine from SVN, libxml2 2.6.20 and libxslt 1.1.14 (note: these are *not* the ones that come with the OS but the problem exists there, too).
Attached are the RelaxNG schema, the invalid document, and a failing unit test. I hope they're not too large for the list. I apologize in advance if they are. FYI: the invalid element is /notebook/sheet/ipython-block/para on line 18.
Hey, I can reproduce this, but am at a loss. It may point to a problem with libxml2 itself. It is of course possible this bug got fixed in 2.6.21 that was released recently, though on the other hand I don't see any mention of Relax NG fixes in the release notes. Would you be willing to write a C version of this and post a message to the libxml2 mailing list? If not, let me know, and I'll try to write a C version and report it myself. Regards, Martijn