Easy Tutorial
❮ Schema Complex Subst Schema Complex Empty ❯

XML Schema complexType Element



Definition and Usage

The complexType element defines a complex type. A complex type element is an XML element that contains other elements and/or attributes.

Element Information

Syntax

(? symbol declares that the element can appear zero or one time, * symbol declares that the element can appear zero or more times.)

Attribute Description
id Optional. Specifies a unique ID for the element.
name Optional. Specifies the name of the element.
abstract Optional. Specifies whether the complex type can be used in the instance document. If true, the element cannot use this complex type directly but must use a complex type derived from it. Default is false.
mixed Optional. Specifies whether character data is allowed between the child elements of this complex type. Default is false. The mixed attribute is not allowed if the simpleContent element is a child element. If the complexContent element is a child element, the mixed attribute can be overridden by the mixed attribute of the complexContent element.
block Optional. Prevents complex types with specified derivation types from being used to substitute this complex type. The value can include #all or a list that is a subset of extension or restriction: extension - prevents complex types derived by extension from being used to substitute this complex type.<br>restriction - prevents complex types derived by restriction from being used to substitute this complex type.<br>#all - prevents all derived complex types from being used to substitute this complex type.
final Optional. Prevents derivation of specified types from this complexType element. The value can include #all or a list that is a subset of extension or restriction. extension - prevents derivation by extension.<br>restriction - prevents derivation by restriction.<br>#all - prevents all derivation (extension and restriction).
any attributes Optional. Specifies any other attributes with non-schema namespaces.

Example 1

The following example has a complex type element named "note":

Example 2

The following example has a complex type "fullpersoninfo" which extends the inherited type by using three additional elements (address, city, and country), derived from another complex type "personinfo":

In the above example, the "employee" element must contain the following elements in order: "firstname", "lastname", "address", "city", and "country".


❮ Schema Complex Subst Schema Complex Empty ❯