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.

   

 

 

 

back to top