∟Constructing New Datatypes with Restriction Facets
This section describes how 'restriction' components with facets can be used to construct new user-defined datatypes by applying restrictions on a single base datatype. The resulting datatype's value space is a subset of the base datatype's value space.
From the previous tutorial we learned what facets are supported in simple built-in datatypes,
now let's see how we use them to contruct new user-defined simple datatypes.
Here some general rules on constructing a new user-defined simple datatype with restriction facets:
New user-defined simple datatype must be defined using "simpleType" component.
A "restriction" sub component must be used inside "simpleType" to specify the
base datatype with the "base" attribute.
The base datatype must be a simple datatype.
"anySimpleType" and "anyAtomicType" can not be used as the base datatype, since they do
not support any facets.
One or more restriction facets can be included in the "restriction" component
to modify facet settings of the base datatype.
When modify a facet, the new setting must be equal to or more retrictive than the old setting.
The resulting datatype's value space is a subset of the base datatype's value space.
Here is a schema template that constructs a user-defined datatype from a base datatype: