prev table of contents next

2.2.3 Defining a String with Length Limits

The XML Schema snippet shown below defines a string type, limiting string lengths to the range 1 to 3.

<xsd:simpleType name="ShortNameType">
  <xsd:restriction base="xsd:string">
    <xsd:minLength  value="1"/>
    <xsd:maxLength  value="3"/>
  </xsd:restriction>
</xsd:simpleType>
Again, this simple type doesn't warrant a class definition of its own. Java's own java.lang.String is used, and the length restriction isn't checked unless you request it.


prev table of contents next