Purpose |
This element enables you to define a content model for a complex data type. You can use three compositors for different ways of combining data: Furthermore, it offers the possibility to define simple content
models ( |
Parent element | xs:element or
xs:schema |
Child elements | xs:all , xs:anyAttribute ,
xs:attribute ,
xs:attributeGroup ,
xs:choice ,
xs:complexContent ,
xs:group ,
xs:sequence ,
xs:simpleContent |
Attributes | abstract ,
block , final ,
mixed ,
name |
Name | Type | Description |
---|---|---|
abstract |
xs:boolean |
If "true", the complex type definition must not be used for validation, i.e. an instance must reference, for example, a derived type via xsi:type. Default: "false". |
block |
This attribute, in conjunction with the xs:schema element's
Alternatively, the special value "#all" indicates that no xsi:type may be used. |
|
final |
This attribute, in conjunction with the xs:schema element's
Alternatively, the special value "#all" prevents both methods of deriving a new type from the current complex type definition. |
|
mixed |
xs:boolean |
Specifies whether the complex type being defined
with the xs:complexType element allows mixed content (i.e. a
combination of text and child elements). The default value for the
mixed attribute is
false , indicating that
mixed content is not allowed.
|
name |
xs:NCName |
For purposes of reuse, it is possible to specify a name attribute for
a complex type definition if This attribute is mandatory for the definition of named complex types. For anonymous complex types it must be omitted. Note: |
This example of a complex type definition is taken from the
"Jazz" schema example as introduced in the
Advanced
Concepts documentation. It uses xs:all
to define a structure containing
the two elements location
and
time
:
<xs:complexType> <xs:all> <xs:element name = "location" type = "xs:normalizedString"/> <xs:element name = "time" type = "xs:dateTime"/> </xs:all> </xs:complexType>
The next example is based on the previous one and adds a sequence to it:
<xs:complexType> <xs:choice> <xs:sequence> <xs:element name = "from" type = "xs:date"/> <xs:element name = "to" type = "xs:date"/> </xs:sequence> <xs:all> <xs:element name = "location" type = "xs:normalizedString"/> <xs:element name = "time" type = "xs:dateTime"/> </xs:all> </xs:choice> </xs:complexType>
The next example shows the definition of an element named
collaborationContext
using a choice that includes
xs:sequence
and
xs:all
.
<xs:element name = "collaborationContext"> <xs:complexType> <xs:choice> <xs:sequence> <xs:element name = "from" type = "xs:date"/> <xs:element name = "to" type = "xs:date"/> </xs:sequence> <xs:all> <xs:element name = "location" type = "xs:normalizedString"/> <xs:element name = "time" type = "xs:dateTime"/> </xs:all> </xs:choice> </xs:complexType> </xs:element>