Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

Extending Complex Types

Much like other object-oriented languages, complex types often derive from other complex types. Derivations—similar to any other classification hierarchy—allow a programmer to specify additional element types and attribute types. The extension element type provides this derivation capability.

The next element describes an extension of the partOptionType complex type presented in the all element type section. Specifically, certain parts require a quantity:

<xsd:complexType name="multiplePartOptionType">
    <xsd:extension base="partOptionType">
        <xsd:element name="color"
        <xsd:element name="size"
        <xsd:element name="quantity"

An element type whose structure type is multiplePartOptionType might look like the following element:

<xsd:element name="multiplePartOption"

Given the preceding element type, the following element is valid in an XML instance:

  • + Share This
  • 🔖 Save To Your Account