XML technologies / XML Schema / XML Schema element reference / xs:complexContent
(Excerpt from “XML Schema” by Eric van der Vlist)
Defining complex content by derivation from a complex type.
<xs:complexContent
id = xs:ID
mixed = xs:boolean
{beliebige Attribute mit einem Nicht-Schema-Namensraum}
>
Content: ((xs:annotation?), (xs:restriction | xs:extension))
</xs:complexContent>May occur within: xs:complexType (local definition), xs:complexType (global definition)
Description
This element defines a complex content model by derivation from a complex type. It is not itself a component, since complex contents are unnamed, but declares the intent to define a complex content model by derivation.
The derivation method is determined not by element xs:complexContent itself but by the choice of its child element: xs:restriction for restriction or xs:extension for extension.
This element can specify whether the content model is mixed, but this information can also be specified on parent element xs:complexType, which also has a mixed attribute.
The mixed character of the content model defined by element xs:complexContent depends on the derivation method and base type. A mixed base type can be restricted to element-only content; otherwise the base type’s mixed character cannot be changed.
Restrictions
If the base type is not mixable, ‹xs:complexContent mixed="true"› is not allowed.
Example
<xs:element name="author">
<xs:complexType>
<xs:complexContent>
<xs:extension base="basePerson">
<xs:sequence>
<xs:element ref="dead" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>Attributes
id
Element ID according to W3C XML Schema.
mixed
If the value is true, the content model is mixed; if it is false, it is element-only; if unset, the content model is determined by attribute mixed of parent element xs:complexType.
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