Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WXS schema schema/htmlbook.xsd failed to compile (ailed to load external entity "http://www.w3.org/2001/xml.xsd") #217

Open
dac514 opened this issue Sep 19, 2018 · 5 comments

Comments

@dac514
Copy link

dac514 commented Sep 19, 2018

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
Copy link
Author

dac514 commented Sep 19, 2018

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?

dac514 added a commit to pressbooks/pressbooks that referenced this issue Sep 19, 2018
gimsieke added a commit to gimsieke/HTMLBook that referenced this issue Sep 19, 2018
@gimsieke
Copy link

I’d rather use the file that is guaranteed to remain available (unless someone removes it from this repo), xml.xsd. See PR #218

@jenstroeger
Copy link

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

<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="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
Copy link

Isn’t that exactly what I suggested in gimsieke@04ab437, mei Guudsder?

@jenstroeger
Copy link

jenstroeger commented Dec 10, 2020

Indeed you did 👍🏼 (Nu klor!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants