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

Using Xerces2 Java API

This chapter provides notes and tutorial examples on Xerces2 Java Parser API. Topics include validating sample XML files with assigned XML Schema files (XSD) with XMLReader and SAXParser classes in Xerces2; Testing default SAXParser implementation in JDK; Validating XSD 1.1 schema with Xerces2 2.11.0 beta version.

XML Schema (XSD) Validation using XMLReader

Running XMLReaderValidator with Xerces2 2.11.0 Beta

Running XMLReaderValidator on XSD 1.1 Schema

XML Schema (XSD) Validation using SAXParser

SAXParser for XSD Validation in JDK 1.7

SAXParser for XSD 1.1 Validation

Xsd11SchemaValidator.java for XSD 1.1 Validation

Xsd11SchemaValidator.java XSD 1.1 Test Result

Conclusion:

  • Xerces2 Java Parser is included in JDK now as the default XML parser.
  • Validating XML document against XSD schema can be done with the javax.xml.validation.Schema class.
  • Validating XML document against XSD schema can be done with both org.xml.sax.XMLReader and javax.xml.parsers.SAXParser classes.
  • "Xerces2 2.11.0 (XML Schema 1.1) (Beta)" version works with the javax.xml.validation.Schema class for XSD 1.1 schema validation.

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

Using Xerces2 Java API - Updated in 2014, by Dr. Herong Yang