[xml] Internal error loading XML schema



Trying to load the following schema causes an internal error in libxml2:

importer.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://www.example.com/fu";>


    <xs:import schemaLocation="imported.xsd"/><!-- moe="1" not allowed
inside import -->

    <xs:simpleType name="smallint">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0"/>
            <xs:maxInclusive value="10"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>

imported.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://www.example.com/fu";>

    <xs:simpleType name="bigint">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="1000"/>
            <xs:maxInclusive value="10000"/>
        </xs:restriction>
    </xs:simpleType>

</xs:schema>

$ xmllint --schema importer.xsd foo.xml
Internal error: xmlSchemaBucketCreate, failed to add the schema bucket
to the hash.
Internal error: xmlSchemaParse, An internal error occured.
WXS schema importer.xsd failed to compile

(tried with both 2.7.6 and a git pull)

Admittedly the schema is incorrect; Xerces reports:
importer.xsd:3:49: error: imported schema 'imported.xsd' has different
target namespace 'http://www.example.com/fu'; expected '{null}'

But libxml2 should report a readable error, not an internal error.

-- 
Life is complex, with real and imaginary parts



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]