Share via


<xsd:complexContent> Element

Contains extensions or restrictions on a complex type that contains mixed content or elements only.

<complexContent
  id = ID 
  mixed = Boolean 
  {any attributes with non-schema Namespace}...>
Content: (annotation?,  (restriction | extension))
</complexContent>

Attributes

  • id
    The ID of this element. The id value must be of type ID and be unique within the document containing this element.

    Optional.

  • mixed
    An indicator of whether character data is allowed to appear between the child elements of this complexType element. The default is false.

    This mixed attribute can override the mixed attribute value specified on the containing complexType element.

    Optional.

Element Information

Number of occurrences

One time

Parent elements

complexType

Contents

Optional. annotation

Required. One and only one of the following elements: restriction (complexContent), or extension (complexContent).

Examples

The following example has a complex type, USAddress, that derives from another complex type, address, by extending the inherited type with two additional elements (state and zipcode).

<xs:complexType name="address">
  <xs:sequence>
   <xs:element name="name"   type="xs:string"/>
   <xs:element name="street" type="xs:string"/>
   <xs:element name="city"   type="xs:string"/>
  </xs:sequence>
 </xs:complexType>

 <xs:complexType name="USAddress">
  <xs:complexContent>
   <xs:extension base="address">
    <xs:sequence>
     <xs:element name="state" type="USState"/>
     <xs:element name="zipcode" type="xs:positiveInteger"/>
    </xs:sequence>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-all.

See Also

Reference

XML Schemas (XSD) Reference
XML Schema Elements