[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
clarification of redefine semantics
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

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.