Home >Online Product Documentation >Table of Contents >Defining complexTypes That Contain Elements and Attributes - Tree View
The purchaseOrder.xsd sample document contains the following complexType definition. This complexType defines three elements, refers to a fourth element, and defines an attribute.
purchaseOrder.xsd
<xsd:complexType name="PurchaseOrderType"> <xsd:sequence> <xsd:element name="shipTo" type="USAddress"/> <xsd:element name="billTo" type="USAddress"/> <xsd:element ref="comment" minOccurs="0"/> <xsd:element name="items" type="Items"/> </xsd:sequence> <xsd:attribute name="orderDate" type="xsd:date"/> </xsd:complexType>
<xsd:sequence> <xsd:element name="shipTo" type="USAddress"/> <xsd:element name="billTo" type="USAddress"/> <xsd:element ref="comment" minOccurs="0"/> <xsd:element name="items" type="Items"/> </xsd:sequence> <xsd:attribute name="orderDate" type="xsd:date"/>
You can specify any number of modifiers in a complexType. Each modifier controls the occurrence of its child nodes. You can specify the same modifier more than once. For example, you might want to specify the sequence modifier, with some child nodes, then the choice modifier with some child nodes, and then the sequence modifier again with other child nodes.
sequence
choice
For example, you can specify 0 for the Min Occur. property and 1 for the Max property. The effect is that the element is optional.
0
1