Enabling Xerces Support

Enabling Xerces Support

The XML parser Apache Xerces has been distributed with all of our products. While not required, its status has been as our recommended XML parser.

Dependencies

The distributed version of Xerces (2.12.2) has required an additional dependency: xml-apis.jar

We ship the corresponding version of xml-apis.jar, and if you want to use a different Xerces version you should always use the correct xml-apis.jar from that Xerces-J release (if it is necessary).

Configuration Changes

Configuration Properties

The com.deltaxml.config.JavaPlatform.useSAXParserFactory property is now set to 'false' by default. This means that when a SAXParser is created inside XML Compare, it is done using an explicit class name that loads Xerces.

Classpath

While the jar files for the command-line tool and the GUI have always contained a classpath containing Xerces, deltanova.jar did not. This has now been updated to include xercesImpl.jar on paths including deltanova.jar.

What Can I Do Without Xerces?

While use of the PipelinedComparator and DocumentComparator classes now requires Xerces, it is still possible to use some of our legacy classes without requiring Xerces.

The PipelinedComparator can still be used without Xerces as the parser as long as LexicalPreservation functionality is not used. If it is, a ClassNotFoundException will be thrown with details about the required Xerces classes. To configure the use of a different parser, please see the 'Using a different parser' section below.

Using a Different Parser

Three changes must be made in order to use a different parser:

  1. Update the configuration properties to use the SAXParserFactory

  2. Remove or rename the existing xercesImpl.jar

  3. Optionally add a different parser to the classpath

Pre-requisites

  1. The com.deltaxml.config.JavaPlatform.useSAXParserFactory must be set to true. See Configuration Properties for more information on how to do this.

  1. The existing xercesImpl.jar will still be loaded from the deltanova.jar classpath. In order to stop this from occurring, either move or rename the xercesImpl.jar in the XML Compare release directory.

  1. This stage is optional. Completing the steps above will cause the JVM's internal parser to be used (this is not recommended). To replace it with a different parser, make the relevant jar files available on the classpath. If the jar files do not advertise themselves as implementing a SAXParserFactory, you will need to set up the JVM property appropriately.