Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Hoang, Anthony M." <ANTHONY.M.HOANG@----.--->
To: xmlschema-dev@--.---
Date: 3/22/2005 2:11:00 PM
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@s...> anthony.m.hoang@s...

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

 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent