xml2rfc
xml2rfc copied to clipboard
"Expecting an element" error text is missing the element itself.
Describe the issue
$ xml2rfc --version
xml2rfc 3.12.2
$ echo '<rfc/>' > minimal.xml
$ xml2rfc minimal.xml
minimal.xml(1): Error: Expecting an element , got nothing, at /rfc
The name of the missing element is missing. The error message should show which element is missing at this location. (The odd spacing around the comma appears to indicate a name was intended to be included here.)
Note that the version I'm running is based on sudo apt install xml2rfc on an Ubuntu machine.
Code of Conduct
- [X] I agree to follow the IETF's Code of Conduct
xml2rfc make use of lxml for XML parsing. This looks like an error upstream issue in lxml.
Following Python script:
from io import StringIO
from lxml import etree
f = StringIO("""
<element name="foo" xmlns="http://relaxng.org/ns/structure/1.0">
<oneOrMore>
<element name="bar">
<text />
</element>
</oneOrMore>
</element>""")
relaxng_doc = etree.parse(f)
relaxng = etree.RelaxNG(relaxng_doc)
valid = StringIO('<foo/>')
tree = etree.parse(valid)
try:
relaxng.assertValid(tree)
except Exception as e:
print(e.error_log)
generates following output:
<string>:1:0:ERROR:RELAXNGV:RELAXNG_ERR_NOELEM: Expecting an element , got nothing