Share via


<xsd:extension> Element (complexContent) 

Contains extensions on complexContent.

<extension
  base = QName
  id = ID 
  {any attributes with non-schema Namespace}...>
Content: (annotation?, ((group | all | choice | sequence)?, ((attribute |
 attributeGroup)*, anyAttribute?)))
</extension>

Attributes

  • base
    The name complexType element.

    The base value must be a qualified name (QName).

    Required.

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

    Optional.

Element Information

Number of occurrences

One time

Parent elements

complexContent

Contents

annotation, attribute, attributeGroup, anyAttribute, choice, all, sequence, group

Example

The following example extends a defined complexType element by adding an element and an attribute.

<xs:complexType name="address">
  <xs:sequence>
    <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="xs:string" />
      </xs:sequence>
      <xs:attribute name="country" type="xs:string" fixed="US" />
    </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