Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XML Schema complexType Element

XML Schema complexType Element


XML Schema Reference Manual Complete XML Schema Reference Manual


Definition and Usage

The complexType element defines a complex type. Elements of a complex type are XML elements that contain other elements and/or attributes.

Element Information

Syntax

id=ID

name=NCName

abstract=true|false

mixed=true|false

block=(#all|list of (extension|restriction))

final=(#all|list of (extension|restriction))

any attributes

(annotation?,(simpleContent|complexContent|((group|all|

choice|sequence)?,((attribute|attributeGroup)*,anyAttribute?))))

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

property 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 the value is true, the element cannot use the complex type directly, but must use a complex type derived from it. The default is false.
mixed

Optional. Specifies whether character data is allowed to appear between the child elements of the complex type. The default is false.

  • If the simpleContent element is a child element, the mixed attribute is not allowed.
  • 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 the specified derivation from being used to substitute for this complex type. The value can contain #all or a list that is a subset of extension or restriction:

    | | final |

    Optional. Prevents the 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.

    | | *any attributes* | Optional. Specifies any other attributes with a non-schema namespace. |

    Example 1

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

      xs:complexType

        xs:sequence

      

      

      

      

        

      

    Example 2

    In the example below there is a complex type "fullpersoninfo", derived from another complex type "personinfo" by extending the inherited type with three additional elements (address, city, and country):

      xs:sequence

        

        

      

      xs:complexContent

        

          xs:sequence

            

            

            

          

        

      

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


    XML Schema Reference Manual Complete XML Schema Reference Manual