Complex Type Definitions

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

Complex Type Definitions

New complex types are defined using the complexType element. These definitions usually contain a set of element declarations, element references, and attribute declarations.

A complex type definition is a set of attribute declarations and content type that apply to the attributes and children of an element information item. Each complex type definition is either a restriction of a complex base type definition or an extension of a simple or complex base type definition or a restriction of the ur-type definition.

A complex type that extends another does so by having additional content model particles at the end of the other type definition's content model, or by having additional attribute declarations, or both.

Example

The following example shows a complex type definition for USAddress.

<xs:complexType name="USAddress">
   <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:element name="street" type="xs:string"/>
      <xs:element name="city" type="xs:string"/>
      <xs:element name="state" type="xs:string"/>
      <xs:element name="zip" type="xs:decimal"/>
   </xs:sequence>
   <xs:attribute name="country" type="xs:NMTOKEN" fixed="US"/>
</xs:complexType>

See Also

Declaring Attributes | Declaring Elements