Share via


<xsd:extension> Element (simpleContent) 

Contains extensions on simpleContent. This extends a simple type or a complex type that has simple content by adding specified attribute(s), attribute group(s), or anyAttribute.

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

Attributes

  • base
    The name of a built-in data type, simpleType element, or complexType which has simple content.

    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

simpleContent,

Contents

annotation, attribute, attributeGroup, anyAttribute

Example

The following example extends a defined simpleType by adding an enumerated attribute.

<xs:simpleType name="mountainBikeSize">
  <xs:restriction base="xs:string">
    <xs:enumeration value="small" />
    <xs:enumeration value="medium" />
    <xs:enumeration value="large" />
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="FamilyMountainBikes">
  <xs:simpleContent>
    <xs:extension base="mountainBikeSize">
      <xs:attribute name="familyMember">
      <xs:restriction base="xs:string">
        <xs:enumeration value="child" />
        <xs:enumeration value="male" />
        <xs:enumeration value="female" />
      </xs:restriction>
    </xs:attribute>
    </xs:extension>
  </xs:simpleContent>
</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