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

The XML Primer: Editing and Validating XML in Stylus Studio

The XML primer demonstrates editing and validating XML in Stylus Studio demonstrates XML editing tools and utilities to simplify working with XML documents. Learn how to automate XML editing operations and troubleshoot XML documents today!

XSV - The XML Schema Validator

XSV is the official reference implementation for the XML Schema language and Stylus Studio is the only XML IDE to provide seamless integration with XSV - the W3C XML Schema Validator. Download Stylus Studio and XSV today.

Java Code Generation

The Stylus Studio Java Codce Generator lets you generate deployable Java code for XQuery and XSLT at the push of a button!

Using Relational Data in XML Applications

"Using Relational Data in XML Applications" By Dr. Michael Kay covers an overview of several common use cases and provides insight into the benefits and drawbacks of using the approaches available today including XQuery and SQL/XML.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member