XML technologies / XML Schema / XML Schema element reference / xs:complexType (local definition)

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

Local definition of a complex type; local definitions cannot be referenced.

<xs:complexType
    id = xs:ID
    mixed = xs:boolean : "false"
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?, (xs:simpleContent | xs:complexContent | (, (xs:group | xs:all | xs:choice | xs:sequence)?, ((xs:attribute | xs:attributeGroup)*, xs:anyAttribute? ?))))
</xs:complexType>

May occur within: xs:element (within xs:all), xs:element (reference or local definition), xs:element (global definition)

Description

A complex type can be defined in several ways: by derivation through elements xs:simpleContent for simple content or xs:complexContent for complex content, or described with xs:sequence for an ordered sequence, xs:choice for a choice of elements, xs:all for an unordered list of elements, or xs:group to reference an element group. Its attributes can additionally be defined with xs:attribute, xs:attributeGroup and xs:anyAttribute.

Complex types describe all conditions on element, character and attribute nodes permitted within the element, except those described by xs:unique, xs:key and xs:keyref , specified directly under the relevant element definition using xs:element.

Restrictions

Constraints specified by xs:unique, xs:key and xs:keyref are defined directly under the relevant element definition using xs:element.

Local definitions cannot be derived by restriction or extension, or substituted. Complex-type restriction and restriction-based redefinition of element groups, including elements with local complex-type definitions, are also limited: restriction must redefine retained elements with explicit derivations.

Unlike other components (xs:element, xs:attribute, xs:group and xs:attributeGroup), local xs:complexType components cannot reference global complex types. Complex-type references use attribute type of xs:element and attribute base of xs:restriction and xs:extension.

Example

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

Attributes

id
Element ID according to W3C XML Schema.

mixed
Specifies whether the content type is mixed.

   

 

 

 

back to top