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

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

Extending a simple content model.

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

May occur within: xs:simpleContent

Description

This element extends a simple type or a complex type with simple content into a complex type with simple content: an element content model with a text node and some attributes. Attribute base specifies the base type; the attributes to add are listed through xs:attributes, xs:attributeGroup and xs:anyAttribute embedded within element xs:extension.

Deriving a simple type by extension this way is the only way to create a complex type with simple content.

Restrictions

The base type’s definition cannot be embedded in element xs:extension, and the base type must be global.

W3C XML Schema uses the same element name (xs:extension) for extending complex types with simple or complex content, but the elements have different content models.

Example

<xs:element name="title">
    <xs:complexType>
        <xs:simpleContent>
            <xs:extension base="string255">
                <xs:attribute ref="lang"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
</xs:element>

Attributes

base
Qualified name of the base type, simple or complex with simple content.

id
Element ID according to W3C XML Schema.

   

 

 

 

back to top