XML Schema Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 4.11

A newer version of this book is located at http://www.herongyang.com/XSD/. You will be automatically redirected this new location. Thank you for your visiting! -- Herong

XML Schema Tutorials - Herong's Tutorial Examples

http://www.herongyang.com/XML-Schema

Copyright © 2009 by Dr. Herong Yang. All rights reserved.

HerongYang.com This free book is a collection of tutorial examples and notes written by the author while he was learning XML Schema and writing XSD (XML Schema Definition) documents. Topics include XML Schema specifications, XML data types, XSD document samples, XML document validation tools like XML Spy, XML document validation programming interfaces like Xerces-J.

Table of Contents

About This Book

Introduction to XML Schema

What Is XML Schema?

"Hello world!" Example of XSD

XML Schema Processors

XML Editor and Schema Processor - XMLPad

Installing WMHelp XMLPad Pro

Creating and Editing XML Documents

Creating and Editing XML Schema Documents

Assigning XML Schema to XML Documents

Validating XML Documents with Assigned XSD

Validating Non-Conforming XML Documents

XMLPad Crash When Validating Non-Conforming XML Documents

Generating XML Schema Diagrams

Java API for XML Processing - JAXP

What Is JAXP?

Downloading and installing Java SE 1.6 Update 2

Compiling and Running Java Programs

XML File DOM Parser - XmlDomFileParser.java

JAXP - XML Schema (XSD) Validation

Standard Steps to Validate XML Documents Against a Schema

XSD Schema File Loader - XsdSchemaLoader.java

XSD Schema File Loading Errors

XSD Schema XML DOM Validator - XsdSchemaDomValidator.java

XSD Schema XML DOM Validation Errors

XSD Schema XML DOM Validator with Error Handler

XSD Schema XML SAX Validator - XsdSchemaSaxValidator.java

XSD Schema XML SAX Validation Errors

XSD Schema XML SAX Validator with Error Handler

XSD Schema XML Validator - Final Version

XML Parser API - Xerces2 Java Parser

Installing Xerces2 Java Parser

Testing Examples of XSD File and XML File

XML Schema (XSD) Validation using XMLReader

XML Schema (XSD) Validation using SAXParser

XML Schema Language - Basics

Schema and Schema XML Representation

Checking Schema Documents - XsdSchemaChecker.java

Creating Schema Documents - "schema" Element

Declaring Root Elements - "element" Element

Specifying Element Datatype - "type" Attribute

Using XML Schema Built-in Datatypes

Using XML Schema Built-in Datatypes Incorrectly

Validating XML Documents again Schema Documents

Deriving New Simple Datatypes - "simpleType" Element

Defining Complex Datatypes - "complexType" Element

Validation Error Examples on Complex Datatypes

XML Schema Built-in Datatypes

Overview of XML Schema Built-in Datatypes

List of Built-in Datatypes

Deriving from Built-in Datatypes - simpleType

Built-in Datatype - "string"

Built-in Datatype - "string" Errors

Built-in Datatype - "dateTime"

Built-in Datatype - "dateTime" Errors

Built-in Datatype - "decimal"

Built-in Datatype - "decimal" Errors

Complex Element Declaration

Complex Element vs. Simple Element

Declaring Empty Elements

Declaring Simple Elements

Declaring Complex Elements with Simple Content

Declaring Complex Elements with Attributes Only

Declaring Complex Elements with Sub Elements Only

Declaring Complex Elements with Attributes and Sub Elements

Declaring Complex Elements with Attributes, Sub Elements & Text Content

Using Shorthand for "complexContent" with "restriction"

XML Schema Location and Namespace in XML Documents

Assigning XML Schema Location in XML Documents

Validating XML Documents with Schema Locations

Validating XML Documents with Schema Locations - JAXP

Assigning XML Schema Location with Namespaces

Testing XML Schema Location with Namespaces

Testing XML Schema Location with Namespaces - JAXP

Overriding Element Types in XML Documents

Overriding Element Type to Empty Content - nillable

Overriding Element Type to Empty Content - xsi:nil

Defining a Derived Datatype from a Base Datatype

Overriding the Base Datatype - xsi:type

Overriding the Base Datatype - Errors

Linking Multiple Schema Documents Together

Schema Component Reuse - "include", "redefine" or "import"

Including Old Schema Documents - "include" Component

Including Old Schema Documents - Examples

Including Old Schema Documents - Errors

Redefining Old Datatypes - "redefine" Component

Redefining Old Datatypes - XML Examples

Redefining Old Datatypes - Errors

Importing Declarations Across Namespaces - "import" Component

Importing Declarations Across Namespaces - Examples

Using Elements Declared in Different Namespaces

Using Elements Declared in Different Namespaces - Errors

Glossary

References

PDF Printing Version

Keywords: XML, Schema, XSD, Validation, W3C, Tutorial, Example

Dr. Herong Yang, updated in 2009
Table of Contents