Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

Empty Content

The simplest form of a complex type is one that specifies empty content. Specifically, the value for an element which represents an instance of this complex type must not contain any text or other XML elements. The following example specifies a customerType element type that specifies a custID attribute type, but explicitly no value:










<xsd:complexType name="customerType">
  <xsd:attribute name="custID"
       type="xsd:positiveInteger"/>
</xsd:complexType>

Note that this typical example uses the shorthand notation described later in this article.

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

<xsd:element name="customer" type="customerType"/>

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

<customer custID="31874" /> 
  • + Share This
  • 🔖 Save To Your Account