<xsd:redefine> Element
Allows simple and complex types, groups, and attribute groups that are obtained from external schema files to be redefined in the current schema.
<redefine
id = ID
schemaLocation = anyURI
{any attributes with non-schema Namespace}...>
Content: (annotation | (simpleType | complexType | group |
attributeGroup))*
</redefine>
Attributes
id
The ID of this element. The id value must be of type ID and be unique within the document containing this element.Optional.
schemaLocation
A URI reference to the location of a schema document.Required.
Element Information
Number of occurrences |
Unlimited |
Parent elements |
|
Contents |
Remarks
The redefine element requires that the external elements exist in the same target namespace as the redefining schema. Schemas without a namespace can also be redefined using the redefine element and the redefined components become part of the schema's target namespace.
The definitions within the redefine element itself must use their current definitions as the base type definition. Attribute group definitions and model group definitions must include exactly one reference to themselves. Not all of the definitions of the redefined schema document must be redefined.
Redefining elements can cause unexpected results, such as ill-formed definitions, on other type definitions that are based on the redefined definitions.
Example
The following example shows a schema, v2.xsd, with elements specified by the v1.xsd. The personName type is redefined. According to this schema, elements constrained by the personName type may end with a generation element.
<xs:complexType name="personName">
<xs:sequence>
<xs:element name="title" minOccurs="0"/>
<xs:element name="forename" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="addressee" type="personName"/>
<xs:redefine schemaLocation="v1.xsd">
<xs:complexType name="personName">
<xs:complexContent>
<xs:extension base="personName">
<xs:sequence>
<xs:element name="generation" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
<xs:element name="author" type="personName"/>
Other Resources
For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-all.