Simple types (both built-in and derived) have facets. A facet is a single defining aspect that helps determine the set of values for a simple type. For example, length, minInclusive, and maxInclusive are common facets for the built-in data types. All of the facets for a simple type define the set of legal values for that simple type.
A facet is defined as an element. Each facet element has a fixed attribute that is a Boolean value. When a simple type is defined, you can prevent derivatives of that type from modifying the value of specified facets. To prevent modification of a facet, add the fixed attribute to the facet and set its value to true.
Facets can only appear once in a type definition except for enumeration and pattern facets. The enumeration and pattern facets can have multiple entries and are grouped together.
The following example shows a simple type with the fixed attribute set to true which prevents the length from having a value other than 7.
<xs:simpleType name="Postcode"> <xs:restriction base="xs:string"> <xs:length value="7" fixed="true"/> </xs:restriction> </xs:simpleType>
The constraining facets (facets that can be used to constrain the values of simple types), their descriptions, and the built-in data types that they apply to, are listed below.
nonNegativeInteger. For more information, see the W3C XML Schema Part 2: Datatypes Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#element-length.nonNegativeInteger. For more information, see the W3C XML Schema Part 2: Datatypes Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#element-maxLength.nonNegativeInteger. For more information, see the W3C XML Schema Part 2: Datatypes Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#element-minLength.preserve, replace, or collapse. The whiteSpace facet cannot be changed for most numeric data types. For more information, see the W3C XML Schema Part 2: Datatypes Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#element-whiteSpace.
preserve |
No normalization is performed; the value is not changed for element content as required by the W3C XML 1.0 Recommendation. |
replace |
All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced with #x20 (space). |
collapse |
After the processing implied by replace, contiguous sequences of #x20s are collapsed to a single #x20, and leading and trailing #x20s are removed. |
XML Schema Element Map | XML Data Types Reference | Primitive XML Data Types | Derived XML Data Types
| This HTML Help has been published using the chm2web software. |