Name

xs:complexType(global definition) — Global definition of a complex type that can be referenced within the same schema by other schemas.

Synopsis

<xs:complexType
           abstract       = xs:boolean : “false”
           block          = ( “#all” | list of ( “extension” | “restriction” ) )
           final          = ( “#all” | list of ( “extension” | “restriction” ) )
           id             = xs:ID
           mixed          = xs:boolean : “false”
           name           = xs:NCName
           {any attributes with non-schema namespace}
           >
           Content: (xs:annotation?, (xs:simpleContent | xs:complexContent | (,
                      (xs:group | xs:all | xs:choice | xs:sequence)?,
                      ((xs:attribute | xs:attributeGroup)*, xs:anyAttribute?
          ?))))
</xs:complexType>

May be included in: xs:redefine, xs:schema

Description

This component is used to create global complex types as direct descriptions of their content model, or by derivation from simple types or other complex types. The creation of a new complex type is done by a compositor (xs:sequence, xs:choice, or xs:all) that describes the child elements, followed by a list of attributes (or attribute groups or attribute wildcards). The derivation of a complex type through existing simple or complex types is done by including an xs:simpleContent (for simple contents) or an xs:complexContent (for complex contents) element. In both cases, when the content is not simple, the mixed attribute defines if the content model is mixed (i.e., allows both text and element nodes) or not.

Several controls are provided through attributes. Complex types can be declared “abstract,” their substitution can be “blocked,” and they can be “final” for derivation.

Restrictions

Constraints about keys (xs:key, xs:unique, and xs:keyref) cannot be defined at this level but need to be defined in the xs:element element. This means that, while in many cases referencing a global element definition or a global complex type definition can be considered as equivalent to define modular content models, complex types are no longer an option when these constraints need to be included in the content model.

Example

<xs:complexType name="title">
  <xs:simpleContent>
    <xs:extension base="tokenWithLang">
      <xs:attribute name="note" type="xs:token"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

Attributes

abstract

When set to true, this complex type cannot be used directly in the instance documents and needs to be substituted using a xsi:type attribute.

block

Controls whether a substitution (either through a xsi:type or substitution groups) can be performed to a complex type, which is an extension or a restriction of the current complex type. This attribute can only block such substitutions (it cannot “unblock” them), which can also be blocked in the element definition. The default value is defined by the blockDefault attribute of xs:schema.

final

Controls whether the complex type can be further derived by extension or restriction to create new complex types.

id

W3C XML Schema’s element ID.

mixed

Defines if the content model will be mixed.

name

Name of the complex type.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.95.38