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

clarification of redefine semantics

From: James Taylor <JTaylor@nextance.com>
Date: Mon, 7 Feb 2005 15:38:26 -0800
Message-ID: <9F5ED6009B16CE47B2C02694103CFBE30B5871@mail-1.nextance.com>
To: <xmlschema-dev@w3.org>
Hi All,
Under what circumstances should a type redefinition create an error
condition regarding multiple definitions of the same type?  In
particular, if a type is redefined when there is also an include that
indirectly loads the type definition, is this an error condition?
For example:
    Company.xsd redefines the Address type from Location.xsd which
includes Address.xsd
    Company.xsd also includes Employee.xsd which 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?
Regards,
    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 Monday, 7 February 2005 23:39:35 GMT

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