XSD Tutorials - Herong's Tutorial Examples
∟"simpleType" - Defining Your Own Simple Datatypes
∟Atomic, List, Atomic Union and List Union Datatypes
This section describes categories of datatypes, Atomic, List, Atomic Union and List Union. And rules of using them to construct new datatypes with 'restriction', 'union' and 'list' components.
In the previous tutorials, we learned how to construct user-defined simple datatypes from built-in datatypes
using "restriction", "union" and "list" components.
Of course, user-defined datatypes can be used in "restriction", "union" and "list" components to define
more user-defined datatypes in a multiple-tier hierarchy.
To help us understand datatype hierarchies and build them correctly, we need to divide simple datatypes into 4 categories:
- Atomic Datatype - A datatype where the entire lexical representation is mapped to a single value in the value space.
And its base datatype is another atomic datatype.
- List Datatype - A datatype where the entire lexical representation is mapped to a list of items separated by whitespaces.
And its item datatype is another atomic datatype or atomic union datatype.
- Atomic Union Datatype - A datatype where the entire lexical representation is mapped to a single value in the value space.
And all of its member datatypes are atomic datatypes or atomic union datatypes.
- List Union Datatype - A datatype where the entire lexical representation is mapped to a single value or a list of values
in the value space.
And one or more of its member datatypes are list datatypes or list union datatypes.
With these categories defined above, we can list some rules that we need to follow
when constructing new user-defined simple datatypes using the "restriction" component:
- "restriction" component can be used with an atomic datatype as its base datatype to apply restrictions on facets
that are supported by the base datatype.
The resulting datatype is still an atomic datatype.
- "restriction" component can be used with a list datatype as its base datatype to apply restrictions on only 5 facets:
"length", "minLength", "maxLength", "pattern", "enumeration" and "assertions".
The resulting datatype is still a list datatype.
- "restriction" component can be used with an atomic union datatype as its base datatype to apply restrictions on only 2 facets:
"pattern", "enumeration" and "assertions".
The resulting datatype is an atomic union datatype.
- "restriction" component can be used with a list union datatype as its base datatype to apply restrictions on only 2 facets:
"pattern", "enumeration" and "assertions".
The resulting datatype is a list union datatype.
Similarly, we need to follow these rules when constructing new user-defined simple datatypes using
the "union" component:
- "union" component can be used with atomic datatypes as its member datatypes.
The resulting datatype is an atomic union datatype.
- "union" component can be used with list datatypes as its member datatypes.
The resulting datatype is a list union datatype.
- "union" component can be used with atomic union datatypes as its member datatypes.
The resulting datatype is still an atomic union datatype.
- "union" component can be used with list union datatypess as its member datatypes.
The resulting datatype is still a list union datatype.
- "union" component can be used with a mixed of one or more list datatypes and other datatypes.
The resulting datatype is still a list union datatype.
- "union" component can be used with a mixed of one or more list union datatypes and other datatypes.
The resulting datatype is still a list union datatype.
Similarly, we need to follow these rules when constructing new user-defined simple datatypes using
the "list" component:
- "list" component can be used with an atomic datatype as its item datatype.
The resulting datatype is a list datatype.
- "list" component can not be used with a list datatype as its item datatype.
- "list" component can be used with an atomic union datatype as its item datatype.
The resulting datatype is a list datatype.
- "list" component can not be used with a list union datatype as its item datatype.
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 APIs
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
►"simpleType" - Defining Your Own Simple Datatypes
What Is Simple Datatype?
"simpleType" Components - User-Defined Simple Datatypes
"simpleType" Components with "restriction" Child Components
"simpleType" Components with "union" Child Components
"simpleType" Components with "list" Child Components
►Atomic, List, Atomic Union and List Union Datatypes
Constraining Facets on List Datatypes
Constraining Facets on Union Datatypes
Nested List Datatypes - Not Allowed
Nested Atomic and List Union 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
Archived Tutorials
References
Full Version in PDF/EPUB