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

Datatypes, Values and Representations - Example

This section provides examples of how element E, datatype T, value V and representation R are related to each others.

To help us remember relations between element E, datatype T, value V and representation R, let's look at several examples:

1. If we are given with the following documents:

In XSD document:
   <xs:element name="data" type="xs:hexBinary"/>

In XML document:
   <data>7065616365</data>

we can assume the following relations:

  • The datatype T is "hexBinary".
  • The element E is "data", which is declared to have datatype "hexBinary".
  • The lexical representation R is "7065616365", which is placed in element "data".
  • The value V is ASCII string of "peace", which is represented as R in Hexadecimal format.

2. If we are given with the following documents:

In XSD document:
   <xs:element name="data" type="xs:integer"/>

In XML document:
   <data>7065616365</data>

we can assume the following relations:

  • The datatype T is "integer".
  • The element E is "data", which is declared to have datatype "integer".
  • The lexical representation R is "7065616365", which is placed in element "data".
  • The value V is integer 7,065,616,365, which is represented as R in decimal format.

3. If we are given with the following documents:

In XSD document:
   <xs:element name="data" type="xs:dateTime"/>

In XML document:
   <data>2013-01-01T00:00:00.000-05:00</data>

we can assume the following relations:

  • The datatype T is "dateTime".
  • The element E is "data", which is declared to have datatype "dateTime".
  • The lexical representation R is "2013-01-01T00:00:00.000-05:00", which is placed in element "data".
  • The value V is the midnight of 2013 new year's eve at New York city, which is represented as R in UTC date and time format.

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

Datatypes, Values and Representations - Example - Updated in 2014, by Dr. Herong Yang