xs:redefine — Inclusion of a W3C XML Schema for the same namespace with possible override.
<xs:redefine id = xs:ID schemaLocation = xs:anyURI {any attributes with non-schema namespace} > Content: (xs:annotation | (xs:simpleType | xs:complexType | xs:group | xs:attributeGroup))* </xs:redefine>
May be included in: xs:schema
xs:redefine
is similar to
xs:include
with one exception: the definition of
simple and complex types and attribute and element groups can be
changed. Changes performed on these components must lead to
components that are valid restrictions or extensions of the original
ones.
Simple and complex types are redefined using the usual mechanism of derivation: the new types must be defined as derivations by restriction or extension of their previous definition, which is considered to be the base type.
Element and attribute groups are redefined by giving a new definition, and may refer to themselves to indicate that the content of their original definition must be included. In this case, this self-reference is not considered a recursive definition (which is forbidden in element and attribute groups), but an extension of the original group.
When xs:redefine
is used and no redefinitions are
specified, its effect is similar to xs:include
.
xs:redefine
can be used only to include schemas
with either the same target namespace or no target namespace. There
is no equivalent to import and redefine schema definitions in a
single operation. The schema must be redefined and imported in two
different operations.
Arbitrary redefinitions are not allowed. After redefinition, the components must be valid derivations (by extension or restriction) of their definitions before redefinition.
xs:element
, xs:attribute
, and
xs:notation
cannot be redefined.
<xs:redefine schemaLocation="complex-types2.xsd"> <xs:complexType name="book"> <xs:complexContent> <xs:restriction base="book"> <xs:sequence> <xs:element ref="isbn"/> <xs:element ref="title"/> <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="bookID"/> <xs:attribute ref="available"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:redefine>