XSD Tutorials - Herong's Tutorial Examples - Version 5.10, by Dr. Herong Yang

List of Facets

This section describes all 14 facets supported in XSD 1.1: ordered, bounded, cardinality, numeric, whiteSpace, length, minLength, maxLength, pattern, enumeration, maxInclusive, maxExclusive, minExclusive, minInclusive, totalDigits, fractionDigits, Assertions, explicitTimezone.

XSD 1.1 supports 2 groups of facets:

1. Fundamental Facets - Facets that are defined on all simple built-in datatypes and should not be modified when constructing new user-defined datatypes. There are 4 fundamental facets:

  • "ordered" - Indicates the order relation of values supported by this datatype. "ordered" has 3 possible settings: "total", "partial", and "false".
  • "bounded" - Indicates whether a upper limit and a lower limit exist for all values supported by this datatype. "bounded" has 2 possible settings: "true", and "false".
  • "cardinality" - Indicates if the number of values supported by this datatype is finite or not. "cardinality" has 2 possible settings: "finite", and "countably infinite".
  • "numeric" - Indicates whether values supported by this datatype are numeric or not. "numeric" has 2 possible settings: "true", and "false".

2. Constraining Facets - Facets that are defined on some simple built-in datatypes and could be modified when constructing new user-defined datatypes. There are 14 fundamental facets:

  • "whiteSpace" - Indicates how witespace characters should be handled when mapping lexical representations to values. "whiteSpace" has 3 possible settings: "preserve", "replace", and "collapse".
  • "length" - Indicates that the number of units in each value must be equal to this setting. Value units are defined differently for different datatypes. For example, "length" on "string" is the number of characters in the value. "length" on "hexBinary" is the number of bytes in the value.
  • "minLength" - Indicates that the number of units in each value must be equal to or greater than this setting.
  • "maxLength" - Indicates that the number of units in each value must be equal to or less than this setting.
  • "pattern" - Indicates that the lexical representation must match this setting as a regular expression pattern.
  • "enumeration" - Indicates that values are enumerated in this setting.
  • "maxInclusive" - Indicates that values must be equal to or less than this setting.
  • "maxExclusive" - Indicates that values must be less than this setting.
  • "minExclusive" - Indicates that values must be equal to or greater than this setting.
  • "minInclusive" - Indicates that values must be greater than this setting.
  • "totalDigits" - Indicates that the total precision of each value must be equal to or less than this setting. "totalDigits" is only applicable to "decimal" and its derived datatypes.
  • "fractionDigits" - Indicates that the arithmetic precision of each value must be equal to or less than this setting. "fractionDigits" is only applicable to "decimal" and its derived datatypes.
  • "Assertions" - Indicates that values must satisfy this setting as an XPath expression.
  • "explicitTimezone" - Indicates that whether timezone unit is required or not in each value. "explicitTimezone" has 3 possible settings: "required", "prohibited" and "optional". "explicitTimezone" is only applicable to date and time related datatypes.

Last update: 2013.

Table of Contents

 About This Book

 Introduction to XML Schema

 XML Editor and Schema Processor - XMLPad

 Java API for XML Processing - JAXP

 JAXP - XML Schema (XSD) Validation

 Xerces2 Java Parser - Java API of XML Parsers

 Using Xerces2 Java API

 XML Schema Language - Basics

 Introduction of XSD Built-in Datatypes

 "string" and Its Derived Datatypes

 "decimal" and Its Derived Datatypes

 "dateTime" and Its Related Datatypes

 Miscellaneous Built-in Datatypes

Facets, Constraining Facets and Restriction Datatypes

 What Is Facet?

List of Facets

 Constructing New Datatypes with Restriction Facets

 Facets Supported in "string"

 Facets Supported in "dateTime"

 Facets Supported in "decimal"

 "simpleType" - Defining Your Own Simple Datatypes

 Complex Element Declaration

 Identity-Constraints: unique, key and keyref

 Assertion as Custom Validation Rules

 XML Schema Location and Namespace in XML Documents

 Overriding Element Types in XML Documents

 Linking Multiple Schema Documents Together

 Glossary

 References

 PDF Printing Version

List of Facets - Updated in 2014, by Dr. Herong Yang