XSD Tutorials - Herong's Tutorial Examples - v5.23, by Herong Yang
Built-in Datatypes Lexical Representation Examples
This section provides lexical representation examples for some commonly used built-in datatypes.
Before going into details of each built-in datatype, I compiled a list of lexical representation examples of some commonly used built-in datatypes.
"boolean" - Any of 4 Boolean values: "1", "0", "true", "false".
"decimal" - Any decimal numbers, like "-1234.456".
"integer" - Any integer numbers, like "-1234456".
"float" - Any floating-point numbers, like "-1234.456e-789".
"double" - Any floating-point numbers, same as "float", like "-1234.456e-789".
"hexBinary" - Any data in hex encoding, like "6865726F6E6779616E672E636F6D".
"base64Binary" - Any data in Base64 encoding, like "aGVyb25neWFuZy5jb20=".
"dateTime" - Date and time, like "2012-12-23T14:19:00".
"dateTimeStamp" - Date and time with timezone required, like "2012-12-23T14:19:00.000-05:00".
"date" - Date only, like "2002-12-23".
"time" - Time only, like "14:19:00.000-05:00".
"gYear" - Year only, like "2002".
"gMonth" - Month only, like "--05" (May of any year).
"gDay" - Day only, like "---05" (the 5th day of any month of any year).
"gYearMonth" - Year and month only, like "2002-12".
"gMonthDay" - Month and day only, like "--05-23" (May 23 of any year).
"duration" - Period of time, like "P0001Y02M03DT04H05M06.000S".
"yearMonthDuration" - Period of time in years and months, like "P0001Y02M".
"yearMonthDuration" - Period of time in days, hours, minutes and seconds, like "P03DT04H05M06.000S".
"string" - Any string, like " Herong \n Yang ".
"normalizedString" - Any string with \t, \r, and \n replaced by " ", like " Herong Yang ".
"token" - Any string with \t, \r, and \n replaced by " ", whitespaces collapsed and trimmed, like "Herong Yang".
"language" - Any language code, like "en-US" or "fr-CA".
"Name" - Any XML "Name" values, like "xs:schema".
"NCName" - Any no-colon XML "Name" values, like "schema".
"NMTOKEN" - Any XML "NMTOKEN" (Name Token) values, like "1st_row:2nd_seat".
"QName" - Any qualified names, like "xs:QName".
"anyURI" - Any IRI (Internationalized Resource Identifier), like "https://www.herongyang.com/XSD/".
Table of Contents
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
►Introduction of XSD Built-in Datatypes
Overview of XSD 1.1 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
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