About Facet Types for simpleTypes

Table 41 provides a brief description of what you should specify as the value of a facet for a new simpleType. You should consult the XML Schema Recommendation for a complete definition of each facet and its allowable values.

Facet
Value
enumeration
One allowable value. Add an enumeration facet for each allowable value. For example:
<xsd:simpleType name="USState">
               

              
  <xsd:restriction base="xsd:string">
                   
    <xsd:enumeration value="AK"/>
                   
    <xsd:enumeration value="AL"/>
                   
    <xsd:enumeration value="AR"/>
                   
    <!-- and so on ... -->
                   
  </xsd:restriction>
                   

                
</xsd:simpleType>
fractionDigits
The maximum number of digits that are allowed in the fractional portion of values of simpleTypes that are derived from xsd:decimal.
length
The number of units of length. Units vary according to the base type. The simpleType must be this number of units of length. For example, if xsd:string is the base type, you might specify 5 as the length if you know that each value will be a code that always has five characters.
maxExclusive
The exclusive upper bound of the range of values allowed for this simpleType. The value of the simpleType must be less than the value of maxExclusive.
maxInclusive
The inclusive upper bound of the range of values allowed for this simpleType. The value of the simpleType must be less than or equal to the value of maxInclusive.
maxLength
The maximum number of units of length. Units vary according to the base type. The length of the instances of this simpleType must be less than or equal to this number of lengths.
minExclusive
The exclusive lower bound of the range of values allowed for this simpleType. The value of the simpleType must be more than the value of minExclusive.
minInclusive
The inclusive lower bound of the range of values allowed for this simpleType. The value of the simpleType must be equal to or more than the value of minInclusive.
minLength
The minimum number of units of length. Units vary according to the base type. The length of the instances of this simpleType must be equal to or more than this number of lengths.
pattern
A regular expression. The values of the simpleType must be literals that match this regular expression.
totalDigits
The maximum number of digits that are allowed in values of simpleTypes that are derived from xsd:decimal.
whiteSpace
Specify one of the following values:
  • preserve indicates that no normalization is done. The value is not changed.
  • replace indicates that each tab, line feed, and return is replaced with a space.
  • collapse indicates that the processing specified by replace is done, and then contiguous sequences of spaces are collapsed into one space.
Table 41. Facet Values for simpleTypes

 
Free Stylus Studio XML Training: