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>
Optional.
Required.
Number of occurrences | Unlimited |
Parent elements | schema |
Contents | annotation, attributeGroup, complexType, group, simpleType |
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.
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.
v1.xsd: <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"/> v2.xsd: <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"/>
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-redefine.