RelaxNG validation does not report all errors in the log
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Low
|
scoder |
Bug Description
The attached XML fails validation with provided RNG schema when using xmllint:
$ xmllint --noout --relaxng test.rng test.xml
test.xml:6: element data: validity error : IDREF attribute ref references an unknown ID "myref"
test.xml fails to validate
However, when using lxml, there is no error returned (validation still fail as expected):
>>> from lxml import etree
>>> rng = etree.RelaxNG(
>>> rng.validate(
False
>>> rng.error_log
>>>
I've managed to figure out that libxml uses the xmlGenericError function at this point to trace this error, and lxm disables generic errors.
If I temporarily re-enable generic error by commenting out line 28 of src/lxml/
>>> rng.validate(
IDREF attribute ref references an unknown ID "myref"
False
-------
Software Versions:
Python : sys.version_
lxml.etree : (3, 5, 0, 0)
libxml used : (2, 9, 3)
libxml compiled : (2, 9, 3)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
Changed in lxml: | |
status: | Fix Committed → Fix Released |
Good catch. Fixed here: /github. com/lxml/ lxml/commit/ c7ae47731a1c017 ce64f93784cc820 34e0669169
https:/