Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


clarification of redefine semantics

From: "James Taylor" <JTaylor@--------.--->
To: <xmlschema-dev@--.--->
Date: 2/7/2005 7:38:00 AM
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>




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