WXS schema schema/htmlbook.xsd failed to compile (ailed to load external entity "http://www.w3.org/2001/xml.xsd")
Opened this issue · 5 comments
dac514 commented
Steps to reproduce:
git clone https://github.com/oreillymedia/HTMLBook.git
cd HTMLBook
xmllint --noout --schema schema/htmlbook.xsd samples/alices_adventures_in_wonderland.html
Output:
warning: failed to load external entity "http://www.w3.org/2001/xml.xsd"
schema/svg/xlink.xsd:27: element import: Schemas parser warning : Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/2001/xml.xsd'. Skipping the import.
schema/svg/xlink.xsd:171: element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration.
schema/svg/SVG.xsd:337: element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}base' does not resolve to a(n) attribute declaration.
schema/svg/SVG.xsd:343: element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration.
schema/svg/SVG.xsd:344: element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}space' does not resolve to a(n) attribute declaration.
schema/svg/SVG.xsd:1389: element attribute: Schemas parser error : attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}space' does not resolve to a(n) attribute declaration.
WXS schema schema/htmlbook.xsd failed to compile
Help?
dac514 commented
In schema/svg/xlink.xsd, changing:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
To:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
Resolves the issue but I'm not sure this is right? I'm a bit surprised http://www.w3.org/2001/XMLSchema would vanish?
gimsieke commented
jenstroeger commented
I think I just encountered a similar problem using Python and lxml:
Python 3.7.9 (default, Sep 6 2020, 16:32:30)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxml.etree
>>> lxml.etree.XMLSchema(file="htmlbook.xsd")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/lxml/xmlschema.pxi", line 88, in lxml.etree.XMLSchema.__init__
lxml.etree.XMLSchemaParseError: attribute use (unknown), attribute 'ref': The QName value '{http://www.w3.org/XML/1998/namespace}lang' does not resolve to a(n) attribute declaration., line 171
@gimsieke*, your suggested workaround didn’t work for me, but considering that svg/xml.xsd is checked into the repo I changed this line
Line 27 in 465453a
to
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>and I could load the schema file:
>>> lxml.etree.XMLSchema(file="htmlbook.xsd")
<lxml.etree.XMLSchema object at 0x10f913a70>
—————
* Hallo nach Leebsch vonnem annern Sachsn!
gimsieke commented
Isn’t that exactly what I suggested in gimsieke@04ab437, mei Guudsder?
jenstroeger commented
Indeed you did 👍🏼 (Nu klor!)