GNOME Bugzilla – Bug 326174
RNG schema fails to compile due to XML comments
Last modified: 2021-07-05 13:26:18 UTC
Please describe the problem: With http://www.vinc17.org/rngtest.tar.bz2, I get the following error: $ xmllint --noout --relaxng test.rng test.xml xmlRelaxNG: include xhtml/xhtml.rng has a start but not the included grammar Some <start> element miss the combine attribute Relax-NG schema test.rng failed to compile But if I remove the comment at the beginning of xhtml/modules/struct.rng and xhtml/modules/frames.rng, then the error disappears: $ xmllint --noout --relaxng test.rng test.xml test.xml validates Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Still occurs with libxml2 2.8.
Simpler testcase: $ cat test.xml <?xml version="1.0"?> <root/> $ cat test.rng <?xml version="1.0"?> <grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"> <include href="test-aux1.rng"> <start combine="choice"> <notAllowed/> </start> </include> <start> <element name="root"> <text/> </element> </start> </grammar> $ cat test-aux1.rng <?xml version="1.0"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <include href="test-aux2.rng"/> </grammar> $ cat test-aux2.rng <?xml version="1.0"?> <!-- Comment --> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <element name="foo"> <text/> </element> </start> </grammar> $ xmllint --noout --relaxng test.rng test.xml test.rng:3: element include: Relax-NG parser error : xmlRelaxNG: include test-aux1.rng has a start but not the included grammar test.rng:9: element element: Relax-NG parser error : Some <start> element miss the combine attribute Relax-NG schema test.rng failed to compile If href="test-aux1.rng" is replaced by href="test-aux2.rng" in test.rng, or if the XML comment in test-aux2.rng is removed, the bug no longer occurs: $ xmllint --noout --relaxng test.rng test.xml test.xml validates
This looks suspiciously similar to bug #655288, but this problem still exists even with my fix for that bug.
This bug is still present in libxml2 2.9.4. Any news?
*** Bug 730705 has been marked as a duplicate of this bug. ***
This bug makes RNG validation impossible to use in some cases, e.g. if DocBook or XHTML official schemas are used, with a double level of inclusion. There doesn't seem to be a workaround.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.