A xs:complexType provides a description of an XML element's content in the instance document. The definition of the xs:complexType can be made globally in which case it has a name and can be re-used within the schema, or it can be inplace and only used within the context it is declared.
Attributes | Description |
---|---|
abstract | When set to true the complex type can not be used directly in an instance XML document via xsi:type. It can however be used as the base type for an element definition. (default false) - Only valid for root level xs:complexType's |
block | Limits the types that can be used in an XML instance document (defaults to the value of the xs:schemas blockDefault attribute if set, otherwise defaults to empty, values '#all' | a list of ('extension', 'list', 'union') separated by whitespace). |
final | Limits deriving types from using this type in certain ways within the schema (defaults to the value of the xs:schemas finalDefault attribute if set, otherwise defaults to empty, values '#all' | or a list of ('extension', 'list', 'union') separated by whitespace) - Only valid for root level xs:complexType's |
id | The id of the schema item (optional) |
mixed | Indicates the instance XML element may contain mixed content (defaults to false) |
name | The name of the xs:complexType - Only valid for root level xs:complexType's |
any | Any other attributes not in the 'http://www.w3.org/2001/XMLSchema' namespace are allowed. |
----------------- | ------ |
Elements | Description |
----------------- | ------ |
xs:annotation | Provides the ability to add documentation and machine readable data. |
xs:simpleContent | Used when the xs:complexType derives from a xs:simpleType. |
xs:complexContent | Used when the xs:complexType derives from another xs:complexType. |
xs:group | Adds the elements from an xs:group to the xs:complexType definition |
xs:all | Adds the elements from an xs:all to the xs:complexType definition |
xs:choice | Adds the elements from an xs:choice to the xs:complexType definition |
xs:sequence | Adds the elements from an xs:sequence to the xs:complexType definition |
xs:attribute | Adds the xs:attribute to the xs:complexType definition |
xs:attributeGroup | Adds the xs:attributeGroup to the xs:complexType definition |
xs:anyAttribute | Adds the xs:anyAttribute to the xs:complexType definition |
Deriving from a xs:complexType
When a xs:complexType derives from another xs:complexType is can do it via extension or restriction.
Deriving from a xs:simpleType
When a xs:complexType derives from a xs:simpleType is can do it via extension, in which case it can add attributes to the resulting type, but not elements.
Content Type
Conceptually a xs:complexType either contains simple or complex content. If the xs:complexType derives from a typed based on xs:anySimpleType (xs:int, xs:string etc) then it is simple. If it derives from a xs:complexType which contains complex content, then it itself is complex (if the xs:complexType does not derive from a type, then it is also complex).