Question about xsd:import / xsd:include standards (different pars er implementations)

I'm working with a set of schema files where "A", "B" and "C" represent
different XML schema files.  "A" and "B" share a target namespace while "C"
sits in a different namespace.

  (1)  "A" includes "B"

  (2)  "A" references an attributeGroup from "C"

  (3)  "B" imports "C"

 

In two XML parsers, I am required to also have:

  (4)  "A" imports "C"

while a third XML parser does not require statement (4).  I thought that
because "A" includes "B" which already imports "C", I am not required to
re-import "C" in "A."

 

Which parser is correct?

 

In other words, do the XML schema standards require the following statement
in my "A.XSD" file (see below)?

  <xsd:import schemaLocation="C.xsd"/>

 

***** SCHEMAS BELOW *****

 

***** BEGIN A.XSD *****

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema targetNamespace="urn:AB" elementFormDefault="qualified"
attributeFormDefault="unqualified" xmlns="urn:AB"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:C="urn:C">

            <xsd:include schemaLocation="B.xsd"/>

                        <!-- <xsd:import schemaLocation="C.xsd"/> -->

            <xsd:element name="elementA" type="typeA"/>

            <xsd:complexType name="typeA">

                        <xsd:sequence>

                                    <xsd:element ref="elementB"/>

                        </xsd:sequence>

                        <xsd:attributeGroup ref="C:groupC"/>

            </xsd:complexType>

</xsd:schema>

***** END A.XSD *****

 

***** BEGIN B.XSD *****

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="urn:AB" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:C="urn:C" targetNamespace="urn:AB" elementFormDefault="qualified"
attributeFormDefault="unqualified">

            <xsd:import namespace="urn:C" schemaLocation="C.xsd"/>

            <xsd:element name="elementB" type="typeB"/>

            <xsd:complexType name="typeB">

                        <xsd:sequence>

                                    <xsd:element ref="C:elementC"/>

                        </xsd:sequence>

            </xsd:complexType>

</xsd:schema>

***** END B.XSD *****

 

 

***** BEGIN C.XSD *****

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns="urn:C" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:C" elementFormDefault="qualified"
attributeFormDefault="unqualified">

            <xsd:element name="elementC" type="typeC"/>

            <xsd:complexType name="typeC">

                        <xsd:simpleContent>

                                    <xsd:extension base="xsd:string"/>

                        </xsd:simpleContent>

            </xsd:complexType>

            <xsd:attributeGroup name="groupC">

                        <xsd:attribute name="attributeC" type="xsd:string"/>

            </xsd:attributeGroup>

</xsd:schema>

***** END C.XSD *****

 

***** SCHEMAS ABOVE *****

 

Thanks in advance for your help,

 

Anthony Hoang

XML Data & Systems Analyst

SAIC - Digital Asset Solutions Division

--------------------------------------------------------------

11400 Commerce Park Drive, Suite 400
Reston, VA 20191

office: +1 (703) 709-3862

fax: +1 (703) 476-1532

email:  <mailto:anthony.m.hoang@saic.com> anthony.m.hoang@saic.com

website:  <http://www.xml.saic.com> www.xml.saic.com

 

Received on Wednesday, 23 March 2005 01:21:03 UTC