Skip to content

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

Open

Description

@dac514

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?

Activity

  1. dac514 commented on Sep 19, 2018

    @dac514
    Author

    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?

  2. added a commit that references this issue on Sep 19, 2018
    04ab437
  3. gimsieke commented on Sep 19, 2018

    @gimsieke

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

  4. jenstroeger commented on Dec 10, 2020

    @jenstroeger

    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! ☺️

  5. gimsieke commented on Dec 10, 2020

    @gimsieke

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

  6. jenstroeger commented on Dec 10, 2020

    @jenstroeger

    Indeed you did 👍🏼 (Nu klor!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions