W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2005

redefine type in case of multiple indirect sibling includes

From: James Taylor <JTaylor@nextance.com>
Date: Fri, 28 Jan 2005 17:13:23 -0800
Message-ID: <9F5ED6009B16CE47B2C02694103CFBE30B5866@mail-1.nextance.com>
To: <xmlschema-dev@w3.org>
Hi All,

 

I'm getting conflicting results from different tools regarding the
validity of a redefine scenario and was hoping you could clear things
up.  Can a type be redefined within the scope of a schema if the schema
defining the type also indirectly includes the type through a sibling
include statement?

 

Here's an example:

    Company.xsd redefines the Address type from Location.xsd which
includes Address.xsd

    Company.xsd includes Employee.xsd which also includes Address.xsd

 

Should I receive errors about duplicate definitions for the Address
type?  If this is not valid, how do I properly redefine the Address type
within the Company.xsd schema?  Thanks,

 

    James

 

Company.xsd

<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:redefine schemaLocation="Location.xsd">

        <xs:complexType name="Address">

            <xs:complexContent>

                <xs:extension base="Address">

                    <xs:sequence>

                        <xs:element name="country" type="xs:string"/>

                    </xs:sequence>

                </xs:extension>

            </xs:complexContent>

        </xs:complexType>

    </xs:redefine>

    <xs:include schemaLocation="Employee.xsd"/>

        <xs:element name="company" type="Company"/>

            <xs:complexType name="Company">

                <xs:sequence>

                    <xs:element name="location" type="Location"/>

                    <xs:element name="employee" type="Employee"
maxOccurs="unbounded"/>

        </xs:sequence>

    </xs:complexType>

</xs:schema>

 

Location.xsd

<xs:schema elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:include schemaLocation="Address.xsd"/>

    <xs:complexType name="Location">

        <xs:sequence>

            <xs:element name="address" type="Address"/>

        </xs:sequence>

    </xs:complexType>

</xs:schema>

 

Employee.xsd

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

<xs:schema elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:include schemaLocation="Address.xsd"/>

    <xs:complexType name="Employee">

        <xs:sequence>

            <xs:element name="name" type="xs:string"/>

            <xs:element name="address" type="Address"/>

        </xs:sequence>

    </xs:complexType>

</xs:schema>

 

Address.xsd

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

<xs:schema elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:complexType name="Address">

        <xs:sequence>

            <xs:element name="street" type="xs:string"/>

            <xs:element name="city" type="xs:string"/>

            <xs:element name="zipCode" type="xs:string"/>

        </xs:sequence>

    </xs:complexType>

</xs:schema>
Received on Saturday, 29 January 2005 01:14:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT