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

List of Built-in Datatypes

This section lists all built-in datatypes supported in XSD 1.1. 50 built-in datatypes can be divided into 7 categories. 4 new datatypes are introduced in XSD 1.1.

Here is a complete list of 50 built-in datatypes defined in XSD 1.1 specification:

anyType: Special, As the base datatype of all XSD datatypes
  all complex types: Placeholder, For user defined complex datatypes
    anySimpleType: Special, As the base datatype
      anyAtomicType: Special, As the base datatype
        anyURI: Primitive, For URI values
        base64Binary: Primitive, For base64 encoded data
        boolean: Primitive, For Boolean values
        date: Primitive, For date values
        dateTime: Primitive, For date and time values 
          dateTimeStamp: Derived, For timestamps
        decimal: Primitive, For decimal values
          integer: Derived, For integer values
            long: Derived, For 64-bit integer values
              int: Derived, For 32-bit integer values
                short: Derived, For 16-bit integer values
                  byte: Derived, For 8-bit integer values
            nonNegativeInteger: Derived, For non negative integers
              positiveInteger: Derived, For positive integers
              unsignedLong: Derived, For 64-bit unsigned integers
                unsignedInt: Derived, For 32-bit unsigned integers
                  unsignedShort: Derived, For 16-bit unsigned integers
                    unsignedByte: Derived, For 8-bit unsigned integers
            nonPositiveInteger: Derived, For non positive integers
              negativeInteger: Derived, For negative integers
        double: Primitive, For 64-bit floating-point values
        duration: Primitive, For time duration values
          dayTimeDuration: Derived, For time duration values
          yearMonthDuration: Derived, For calendar date durations
        float: Primitive, For 32-bit floating-point values
        gDay: Primitive, For Gregorian calendar day values
        gMonth: Primitive, For Gregorian calendar month values
        gMonthDay: Primitive, For Gregorian calendar month and day
        gYear: Primitive, For Gregorian calendar year values
        gYearMonth: Primitive, For Gregorian calendar year and month
        hexBinary: Primitive, For HEX encoded data
        NOTATION: primitive, For user defined notations
        QName: Primitive, For QName values
        string: Primitive, For string values
          normalizedString: Derived, For strings without \t, \r, \n
            token: Derived, For For strings with whitespaces collapsed
              language: Derived, For Langage values defined in BCP47
              Name: Derived, For XML Name values
                NCName: Derived, For XML non-colonized Name values
                  ENTITY: Derived, For XML ENTITY values
                  ID: Derived, For XML ID values
                  IDREF: Derived, For XML IDREF values
              NMTOKEN: Derived, For XML NMTOKEN values
        time: Primitive, For time values
      ENTITIES: List, For lists of ENTITY values
      IDREFS: List, For lists of IDREF values
      NMTOKENS: List, For lists of NMTOKEN values

As you can see from the above list, 50 XSD 1.1 built-in datatypes can be divided into 7 categories based on the value of their values:

  • Special value category - 3 datatypes: anyType, anySimpleType, anyAtomicType.
  • Numeric value category - 16 datatypes: float, double, decimal, integer, nonPositiveInteger, nonNegativeInteger, negativeInteger, positiveInteger, long, int, short, byte, unsignedLong, unsignedInt, unsignedShort, unsignedByte.
  • Date and time value category - 12 datatypes: dateTime, dateTimeStamp, date, time, gDay, gMonth, gYear, gYearMonth, gMonthDay, duration, dayTimeDuration, yearMonthDuration.
  • String value category - 12 datatypes: string, normalizedString, token, language, NMTOKEN, Name, NCName, ID, IDREF, ENTITY, QName, OTATION.
  • URI value category - 1 datatypes: anyURI.
  • Binary value category - 2 datatypes: hexBinary, base64Binary.
  • Boolean value category - 1 datatype: boolean.
  • List value category - 3 datatypes: ENTITIES, IDREFS, NMTOKENS.

Note that 4 new built-in datatypes are introduced in XSD 1.1:

  • anyAtomicType - A new datatype introduced to separate list datatypes from other built-in datatypes.
  • dateTimeStamp - A new datatype introduced to represents timestamps with timezone required.
  • dayTimeDuration - A new datatype introduced to represents durations with only day, hour, minutes, and/or seconds fields.
  • yearMonthDuration - A new datatype introduced to represents durations with no day, hour, minute, or seconds fields.

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

 Glossary

 References

 PDF Printing Version

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