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

What Is XSD (XML Schema Definition)?

This section provides a quick description of what is XSD (XML Schema Definition) - a language to define rules to validate XML documents.

What is XSD (XML Schema Definition)? XSD (XML Schema Definition) is an XML schema language recommended by W3C (World Wide Web Consortium). An XML schema is a set of rules to which an XML document must conform in order to be considered 'valid' according to that schema. An XML schema language is a set of rules on how to write an XML schema.

The current version (last modification date: 5 April 2012) XSD is 1.1 Its specifications are divided into 2 parts and available at W3C web site: http://www.w3.org/XML/Schema:

  • W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures - Sets out the structural part of the XSD Language.
  • W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes - Define datatypes to be used in the XSD Language.

Some quick notes on XSD 1.1:

  • XSD 1.1 is superset of XML Schema 1.0.
  • XSD 1.1 is designed to validate XML 1.1 and XML 1.0 documents.
  • XSD 1.1 validation rules are written in XML documents.
  • XML 1.1 supports its own datatypes.

The previous version (last modification date: October 28, 2004) XSD was called XML Schema 1.0. Its specifications are divided into 3 parts and available at W3C web site: http://www.w3.org/XML/Schema:

  • XML Schema Part 0: Primer - An easily readable description of XML Schema and a quick tutorial on how to write XML schema documents using XML Schema.
  • XML Schema Part 1: Structures - A set of rules specifying the XML Schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents.
  • XML Schema Part 2: Datatypes - A set of rules specifying datatypes to be used in XML Schema.

Last update: 2013.

Table of Contents

 About This Book

Introduction to XML Schema

What Is XSD (XML Schema Definition)?

 "Hello world!" Example of XSD

 XML Schema Processors

 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

What Is XSD (XML Schema Definition)? - Updated in 2014, by Dr. Herong Yang