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

"string" and Its Derived Datatypes

This chapter provides notes and tutorial examples on 'string' and its derived datatypes. Topics include introduction of string, normalizedString, token, language, Name, NCName, ENTITY, ID, IDREF, NMTOKEN datatypes; sample XSD documents and XML documents showing how to use them.

"string" Datatype Values and Representations

"normalizedString" Datatype Values and Representations

"token" Datatype Values and Representations

"language" Datatype Values and Representations

"language" Datatype Values - Invalid Inputs

"Name" Datatype Values and Representations

"NMTOKEN" Datatype Values and Representations

"NCName" Datatype Values and Representations

"ENTITY" Datatype Values and Representations

"ID" Datatype Values and Representations

"IDREF" Datatype Values and Representations

Conclusion:

  • "string" is the most commonly used XSD built-in datatype. whitespace characters are preserved in "string" values.
  • "normalizedString" values are "string" values with whitespace characters replaced (normalized) into space ' ' characters.
  • "token" values are "normalizedString" values with whitespace characters collapsed and trimmed.
  • "language" values are "token" values with a special pattern to represent language codes like "en-US" or 'fr-CA".
  • "Name" values are "token" values with a special pattern to represent XML element and attribute names like "xs:integer" or "xmlns:xs".
  • "NMTOKEN" values are "token" values similar to "Name" values with less restrictions on the leading character. "NMTOKEN" stands for "Name Token".
  • "NCName" values are "Name" values with ":" removed. "NCName" stands for "Non-Colonized Name".
  • "ENTITY" values are "NCName" values that must match used defined unparsed external XML entities.
  • "ID" values are "NCName" values that must be unique in a single XML document. "ID" values designed as unique identifier of specific XML elements.
  • "IDREF" values are "NCName" values that must match "ID" values exist in the same document.

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

"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

"string" and Its Derived Datatypes - Updated in 2014, by Dr. Herong Yang