The simpleType element restricts the value of another simple type. Listing 10.1 demonstrates the XML representation of partNameType. A part name represents a short description of a part. The name is limited to 40 characters, perhaps due to database or screen real estate limitations.
<xsd:simpleType name="partNameType" final="list,union" id="catalog.partName.sType"> <xsd:annotation> <xsd:documentation xml:lang="en"> A part name can be almost anything. The name is a short description. </xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:token" id="pnt-rst"> <xsd:minLength value="1"/> <xsd:maxLength value="40"/> </xsd:restriction> </xsd:simpleType> |
An element type whose structure type is partNameType might look like the following element:
<xsd:element name="partName" type="partNameType"/>
Given the preceding element type, the following element is valid in an XML instance:
<partName>Short Description of Unit 1</partName>
3.21.233.41