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

Installing Xerces2 Java Parser for XSD 1.1

This section provides a quick introduction of Xerces2 and a tutorial of downloading and installing Xerces2 2.11.0 beta to support XSD 1.1.

Xerces2 Java Parser? Xerces2 Java Parser is an open source Java API of XML parsers. Xerces2 Java Parser supports XML standards, XInclude, DOM, SAX, JAXP, and XML Schema.

The current version of Xerces2 Java Parser is release 2.11.0, which supports the following standards and APIs:

  • eXtensible Markup Language (XML) 1.0 Fourth Edition Recommendation
  • Namespaces in XML 1.0 Second Edition Recommendation
  • eXtensible Markup Language (XML) 1.1 Second Edition Recommendation
  • Namespaces in XML 1.1 Second Edition Recommendation
  • XML Inclusions (XInclude) Version 1.0 Second Edition Recommendation
  • Document Object Model (DOM) Level 3 Core, Load and Save, (DOM) Level 2 Core, Events, and Traversal and Range Recommendations
  • Element Traversal First Edition Recommendation
  • Simple API for XML (SAX) 2.0.2 Core and Extensions
  • Java APIs for XML Processing (JAXP) 1.4
  • Streaming API For XML (StAX) 1.0 Event API (javax.xml.stream.events)
  • XML Schema 1.0 Structures and Datatypes Second Edition Recommendations
  • XML Schema 1.1 Structures and Datatypes Working Drafts (December 2009)
  • XML Schema Definition Language (XSD): Component Designators (SCD) Candidate Recommendation (January 2010)

Xerces2 is integrated into JDK 1.7 through the JAXP API now. It is recommended to perform XML Schema validation using JAXP API instead of using Xerces2 directly. See other chapters in this book for JAXP tutorial examples.

However the latest version of Xerces2 for XSD 1.1 support, Xerces2 2.11.0 (XML Schema 1.1) (Beta), is not integrated into JDK yet. So if you want to play with XSD 1.1 features, you need to install the Xerces2 Java 2.11.0 XML Schema 1.1 Beta version on your local computer. Here are the steps:

1. Go to the Xerces2 Java Parser home page: http://xerces.apache.org/xerces2-j/.

2. Click the menu link "Download", then click the "Binary Distributions" link.

3. Click the "Xerces2 Java 2.11.0 (XML Schema 1.1) (Beta) - zip" link to start the download.

4. Save the downloaded file to \temp\Xerces-J-bin.2.11.0-xml-schema-1.1-beta.zip.

5. Unzip \temp\Xerces-J-bin.2.11.0-xml-schema-1.1-beta.zip, then move and rename the resulting directory to \local\xerces-2_11_0-xml-schema-1.1-beta.

6. Locate the JAR file \local\xerces-2_11_0-xml-schema-1.1-beta\xercesImpl.jar to make sure that the installation was done correctly.

For comparison reason, I also downloaded and installed the regular version of Xerces 2.11.0 in \local\xerces-2_11_0.

Last update: 2014.

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

Installing Xerces2 Java Parser for XSD 1.1

 Verifying Installation of Xerces2

 Xerces2 Sample Program List

 Xerces2 Sample Program dom.Counter

 dom.Counter Validating XML with Associated XSD

 dom.GetElementsByTagName and dom.Writer

 sax.DocumentTracer and sax.Writer

 Examples of XSD and XML Files with Errors

 sax.Writer Reporting Errors Embedded in XML Structure

 XSD 1.1 not Supported by sax.Writer

 XSD 1.1 Supported by jaxp.SourceValidator

 Examples of XSD 1.1 and XML Files with Errors

 jaxp.TypeInfoWriter as an XSD 1.1 Validation Tool

 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



 PDF Printing Version

Installing Xerces2 Java Parser for XSD 1.1 - Updated in 2014, by Dr. Herong Yang