XML technologies / XML Schema / XML Schema element reference / xs:complexType (global definition)
(Excerpt from “XML Schema” by Eric van der Vlist)
Global complex-type definition referenceable within the same schema or from others.
<xs:complexType
abstract = xs:boolean : "false"
block = ( "#all" | list of ( "extension" | "restriction" ) )
final = ( "#all" | list of ( "extension" | "restriction" ) )
id = xs:ID
mixed = xs:boolean : "false"
name = xs:NCName
{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:redefine, xs:schema
Description
This component creates global complex types by directly describing their content models or deriving from simple or complex types. A new complex type uses a compositor (xs:sequence, xs:choice or xs:all) describing child elements, followed by a list of attributes, attribute groups or wildcards. Derivation from existing simple or complex types specifies elements xs:simpleContent for simple content or xs:complexContent for complex content. Unless content is simple, attribute mixed specifies whether content is mixed, allowing both text and element nodes.
Attributes provide further controls: complex types may be abstract, their substitution blocked, or further derivation prevented by making them final.
Restrictions
Key constraints (xs:key, xs:unique and xs:keyref) cannot be defined here; they must be specified in element xs:element. Global element references and global complex-type definitions often seem equivalent ways to define modular content models, but complex types cannot be used when such constraints must be included.
Example
<xs:complexType name="title">
<xs:simpleContent>
<xs:extension base="tokenWithLang">
<xs:attribute name="note" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>Attributes
abstract
If the value is true, this complex type cannot be used directly in instance documents and must be substituted through attribute xsi:type.
block
Controls whether substitution, through xsi:type or substitution groups, may use a complex type extending or restricting this one. It can only block substitutions also blockable in the element definition; they cannot be unblocked. The default is given by attribute blockDefault of xs:schema.
final
Controls whether this type may be further derived by extension or restriction to create complex types.
id
Element ID according to W3C XML Schema.
mixed
Specifies whether the content model is mixed.
name
Complex-type name.
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