RelaxNG validation does not report all errors in the log

Bug #1526522 reported by Audric Schiltknecht
6
This bug affects 1 person
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(file="test.rng")
>>> rng.validate(etree.parse("test.xml"))
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/xmlerror.pxi (first line of code of the _initThreadLogging() function), I can see the log message as a trace in my console:

>>> rng.validate(etree.parse("test.xml"))
IDREF attribute ref references an unknown ID "myref"
False

---------------------
Software Versions:

Python : sys.version_info(major=3, minor=5, micro=0, releaselevel='final', serial=0)
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)

Revision history for this message
Audric Schiltknecht (audric-schiltknecht) wrote :
Revision history for this message
Audric Schiltknecht (audric-schiltknecht) wrote :
Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
importance: Undecided → Low
milestone: none → 3.9.0
status: New → Fix Committed
summary: - RelaxNG validation silent some errors
+ RelaxNG validation does not report all errors in the log
scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.