XML technologies / XML Schema / XML Schema element reference / xs:redefine
(Excerpt from “XML Schema” by Eric van der Vlist)
Inclusion of a W3C XML Schema for the same namespace, possibly changing definitions.
<xs:redefine
id = xs:ID
schemaLocation = xs:anyURI
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: (xs:annotation | (xs:simpleType | xs:complexType | xs:group | xs:attributeGroup))*
</xs:redefine>May occur within: xs:schema
Description
xs:redefine behaves like xs:include, except that definitions of simple and complex types and element and attribute groups may change. Changed components must be valid restrictions or extensions of the originals.
Simple and complex types are redefined through ordinary derivation: new types must be restrictions or extensions of their previous definitions, treated as base types.
Element and attribute groups are redefined by supplying new definitions. Self-references indicate where to include the original content. Such a self-reference is treated as extension of the original group, not as a recursive definition, which is forbidden for these groups.
If xs:redefine is used without redefinitions, the result resembles that of xs:include.
Restrictions
xs:redefine can include only schemas with the same target namespace or none. There is no equivalent way to import and redefine definitions in one operation; redefinition and import must be separate steps.
Arbitrary redefinitions are forbidden. Redefined components must be valid derivations, by extension or restriction, of their previous definitions.
xs:element, xs:attribute and xs:notation cannot be redefined.
Example
<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>Attributes
id
Element ID according to W3C XML Schema.
schemaLocation
Location of the schema to redefine.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de