August 2003
Intermediate to advanced
624 pages
15h 3m
English
Just as people want schemas to prevent them from truncating alphanumeric fields, they also want schemas to set upper limits on numeric fields so they don't cause truncations or overflows. Using our working example, we could restrict the zip code to a set of values as follows:
<xs:simpleType name="zipCodeType">
<xs:annotation>
<xs:documentation>Here we define a ZIP Code as an integer
from 1 through 99999
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="99999"/>
</xs:restriction>
</xs:simpleType>
|
This type of minimum and maximum value restriction probably makes more sense for the amount due on an invoice, ...