Over a million developers have joined DZone.

Xerces-J Adds XML Schema 1.1

DZone 's Guide to

Xerces-J Adds XML Schema 1.1

· Java Zone ·
Free Resource
A Java library for parsing and editing XML documents, Xerces-J, released version 2.10.0 this weekend.  At version 2.x, the Apache project introduced a modular framework for building parser components and configurations.  It is called the Xerces Native Interface (XNI).  The major addition to this weekend's release is the experimental implementation of the XML Schema 1.1 Structures and Datatypes.

The Xerxes Java Parser is a fully conforming XML Schema 1.0 processor.  It is also a complete implementation of the Document Object Model Level 3 Core and Load/Save W3C recommendations.  It provides an implementation of the XML Inclusions (XInclude) W3C recommendation as well.

The new version of Xerxes-J can parse documents using the XML 1.1 recommendation, but it doesn't have an option yet to enable normalization checking.  Currently, it can handle namespaces according the the XML 1.1 Namespaces Recommendation and it correctly serializes XML 1.1 documents if the DOM level 3 load/save APIs are in use.

There's no learning curve for Xerxes' XNI if standard interfaces like JAXP, DOM, and SAX are used.  However, developers can get more power and flexibility than what's provided by the standard interfaces if they understand XNI.  Check out the XNI Manual for more information.

Xerxes-J 2.10 contains parser-related sections of JAXP 1.4 and partial support for StAX 1.0.  Enhancements to javax.xml.validation that were introduced in JAXP 1.4 include support for StAXSource/StAXResult as an input/output to the JAXP Validator, StreamResult as an output to the JAXP Validator, and StAXSource as an input to the SchemaFactory.  The implementation of the DOM Element Traversal API is complete in 2.10.

Here are the other features added to Xerces-J 2.10.0:

  • Implemented a property for starting schema assessment from a specific element declaration and enhanced the existing property for starting schema assessment from a type definition to accept a javax.xml.namespace.QName as a value.
  • Added a property for specifying the locale to use when reporting error and warning messages.
  • Added support for matching multi-digit back references in regular expressions.
  • Added a method to the ItemPSVI interface in the XML Schema API to expose error messages corresponding to the error codes that were already available in the PSVI.
  • Implemented native support for UTF-16.
  • Improved usability of the XML Schema API by updating XSNamedMap and all of the list type interfaces to extend java.util.Map and java.util.List respectively.
  • Improved performance by eliminating excessive calls to XMLSchemaValidator.findSchemaGrammar() when processing local elements with no namespace.
  • Improved recovery from schema loading errors.
  • Improved performance of Element.getBaseURI() when the depth of the node to the document root is longer.
  • Implemented several improvements in the DOM implementation to help the garbage collector reclaim objects which are no longer reachable by the application but were held on to strongly by the Document node.
  • Improved the messages reported for minOccurs/maxOccurs related schema validation errors.

Xerces-J 2.10 supports the following APIs:

  • XML 1.0 (4th Edition)
  • Namespaces in XML 1.0 (2nd Edition)
  • XML 1.1 (2nd Edition)
  • Namespaces in XML 1.1 (2nd Edition)
  • W3C XML Schema 1.0 (2nd Edition)
  • W3C XML Schema 1.1 (Working Drafts, December 2009)
  • XInclude 1.0 (2nd Edition)
  • OASIS XML Catalogs 1.1
  • SAX 2.0.2
  • DOM Level 3 Core, Load and Save
  • DOM Level 2 Core, Events, Traversal and Range
  • Element Traversal (org.w3c.dom.ElementTraversal)
  • JAXP 1.4
  • StAX 1.0 Event API (javax.xml.stream.events)

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}