<<< Here's the <wind> part of the weather report:
<wind>
<direction>NNW</direction>
<speed>5</speed>
</wind>
This time, we'll make the specification for the sub-elements of <wind> in a separate location. We'll create a complex type named WindType so that our schema can use it like this:
<element name="wind" type="ewe:WindType"/>
In our definition of WindType, we need to validate that the <direction> is one of the sixteen compass directions. The XML Schema <enumeration> element lets us do exactly that.
<simpleType name="DirectionType" base="string">
<enumeration value="N"/>
<enumeration value="NNE"/>
<enumeration value="NE"/>
<enumeration value="ENE"/>
<!-- and so on ... -->
</simpleType>
To complete our defintion for WindType, we add the <speed> element and require it to be an integer greater than or equal to zero.
<complexType name="WindType">
<element name="direction" type="ewe:DirectionType"/>
<element name="speed" type="nonNegativeInteger"/>
</complexType>
On the next page, you can see the entire schema. >>>