XML technologies / XML Schema / XML Schema element reference / xs:extension (complex content)

(Excerpt from “XML Schema” by Eric van der Vlist)

Extending a complex content model.

<xs:extension
    base = xs:QName
    id = xs:ID
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: ((xs:annotation?), (, (xs:group | xs:all | xs:choice | xs:sequence)?, ((xs:attribute | xs:attributeGroup)*, xs:anyAttribute?)))
</xs:extension>

May occur within: xs:complexContent

Description

Extending a complex type with complex or mixed content. This derivation applies to another complex base type with complex content and permits adding elements and attributes. Additional elements follow the compositor used in the base type.

Adding elements during extension yields a content model equivalent to a sequence of the base type’s compositor and the compositor in element xs:extension.

Restrictions

Complex types using an xs:all compositor cannot be bases for extension unless only attributes are added.

New elements added to base types using an xs:choice compositor are appended sequentially after xs:choice, rather than as new alternatives.

Example

<xs:element name="character">
    <xs:complexType>
        <xs:complexContent>
            <xs:extension base="basePerson">
                <xs:sequence>
                    <xs:element ref="qualification"/>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:element>

Attributes

base
Qualified name of the base type.

id
Element ID according to W3C XML Schema.

   

 

 

 

back to top