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

Overview of XSD 1.1 Built-in Datatypes

This section describes what are built-in datatypes defined in XSD 1.1 specification. There are total of 49 built-in datatypes. And 19 of them are primitive datattypes.

Before moving on to more complex XSD schema definitions, we need to have a better understanding of how many built-in datatypes are supported, what are they, and how they are related to each other.

To know many built-in datatypes in XSD 1.1, we can look at this diagram included in the XSD 1.1 specification:
XSD 1.1 Built-in Datatypes

Here is what I learned from this diagram:

  • There is 1 special entry in the diagram called "all complex types" which represents all user defined custom datatypes.
  • All other 50 entries in the diagram represent 50 built-in datatypes which are predefined in XSD 1.1.
  • There are 3 special built-in datatypes: anyType, anySimpleType and anyAtomicType, that are acting like base datatypes for major built-in datatype groups.
  • Other 47 non-special built-in datatypes are divided 3 groups: 19 Primitive (or Primitive Atomic Built-in) datatypes, 25 Other built-in atomic (or Derived Atomic Built-in) datatypes and 3 Built-in list (or List Built-in) datatypes.

By reading more details in XSD 1.1 specification, I have the following understanding of how built-in datatypes are grouped:

Primitive Datatypes - A primitive datatype has a value set with only original values, which are not shared with other primitive datatypes. For example, "decimal" and "string" are primitive datatypes. "decimal" values represent numerical values. "string" values represent character sequences. They do not share any values.

Derived Datatypes - A derived datatype has a value set derived from another datatype, called the base datatype. The value set of a derived datatype is a subset of the value set of the base datatype. For example, "integer" is a derived datatype, derived from the base datatype, "decimal". "integer" value set is a subset of "decimal" value set. In other words, all valid "integer" values are valid "decimal" values.

Atomic Datatypes - An atomic datatype is a datatype whose values are individual values, not constructed from other values. For example, "NMTOKEN" is an atomic datatype, because its values are individual values. Each "NMTOKEN" value can not be treated as a structure of other datatype values.

List Datatypes - A list datatype is a datatype whose values are lists of other datatype values. For example, "NMTOKENS" is a list datatype, because its values are lists of "NMTOKEN" values.

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

Overview of XSD 1.1 Built-in Datatypes

 List of Built-in Datatypes

 Datatypes, Values and Representations

 Datatypes, Values and Representations - Example

 Built-in Datatypes Lexical Representation Examples

 Declaring Elements and Attributes with Built-in Datatypes

 Defining New Datatypes with Built-in Datatypes

 "anyType" Built-in Datatype Values and Representations

 "anySimpleType" Built-in Datatype Values and Representations

 "anyAtomicType" Built-in Datatype Values and Representations

 "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

 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



 PDF Printing Version

Overview of XSD 1.1 Built-in Datatypes - Updated in 2014, by Dr. Herong Yang