El Complextype
* * Complete XML Schema Reference Manual](#)
* * *
## 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
* **Parent Elements:** element, redefine, schema
### Syntax
(annotation?,(simpleContent|complexContent|((group|all|
choice|sequence)?,((attribute|attributeGroup)*,anyAttribute?))))
(The ? symbol indicates that the element may appear zero or one time, and the * symbol indicates that the element may 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 instance documents. If the value is true, the element cannot directly use this complex type but must use a derived complex type from it. Default value is false. |
| mixed | Optional. Specifies whether character data is allowed between child elements of this complex type. Default value is false. * If the simpleContent element is a child, the mixed attribute is not allowed. * If the complexContent element is a child, 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 contain #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. * restriction - prevents complex types derived by restriction from being used to substitute this complex type. * #all - prevents all derived complex types from being used to substitute this complex type. |
| final | Optional. Prevents specified types from being derived from this complexType element. The value can contain #all or a list that is a subset of extension or restriction. * extension - prevents derivation by extension. * restriction - prevents derivation by restriction. * #all - prevents all derivation (both 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 contains a complex type "fullpersoninfo", which extends the inherited type by adding 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".
* * Complete XML Schema Reference Manual](#)
YouTip