I am using Xerces 2.7.1.

A schema associated with one namespace is trying to import multiple schemas that are each associated with another namespace. Only the first in a sequence of imports appears to be processed. (The same thing happens if the sequence contains both includes and imports; the first such element, whether an import or include, is the only one that appears to be processed.)

When types from the schemas associated with all but the first import or include are encountered in the top level schema, I see a lot of unresolved references.

A sequence of includes works properly, by the way. The issue is encountered only if imports are involved.

I created a simplified version of what I am seeing. I have 3 schemas, all in the same directory.

Top.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="topLevelNS" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns="topLevelNS"
xmlns:b = "bottomLevelNS">
    <xs:import namespace="bottomLevelNS" schemaLocation="A.xsd"/>
    <xs:import namespace="bottomLevelNS" schemaLocation="B.xsd"/>

    <xs:element name="root">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="A" type="b:AType"/>
                <xs:element name="B" type="b:BType"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


A.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="bottomLevelNS" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns="bottomLevelNS">
    <xs:simpleType name="AType">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
</xs:schema>

B.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="bottomLevelNS" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns="bottomLevelNS">
    <xs:simpleType name="BType">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
</xs:schema>

When I validate Top.xsd, I see:

ERROR - Line 11 [42] {Top.xsd}: src-resolve: Cannot resolve the name 'b:BType' to a(n) 'type definition' component.


When I change the order of the imports, I see that b:AType is not resolved instead.

I am obviously not understanding something here, since I believe that Top.xsd is valid. Would someone please help me?

Thanks,
Lisa


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to