Skip navigation links

Package com.deltaxml.api

A low-level JAXP interface for advanced users supporting comparison and recombination.

See: Description

Package com.deltaxml.api Description

A low-level JAXP interface for advanced users supporting comparison and recombination.

The comparison (or diff) function between two XML trees produces a delta tree which describes the differences between the two input trees. The recombination (or patch) operation can use the delta tree produced by the comparison and one of the original input files and regenerate the other input file.

NOTE: A new package: com.deltaxml.core provides a PipelinedComparator class which makes the construction of XML filtering pipelines much easier. We recommend new users should consider using this package first. This package is provided and maintained for those users who the PipelinedComparator does not provide a solution and who need under the hood access to JAXP pipelining and also for forwards-compatibility for existing 2.x release users.


This API requires:

JAXP is required to provide a pluggable SAX Parser. The one included in the JDK will suffice, however alternative implementations including those provided in Saxon version 6, Xerces or Sun's JAXP reference implementation (also known as the crimson parser) can be used.

The software also uses the Result and Source interfaces from JAXP to specify the sinks and sources for the compare and combine operations. These are normally part of TrAX and can be provided by including xalan.jar from the Xalan-J version 2 release or by using jaxp.jar from Sun's JAXP1.1 reference implementation.

Copies of saxon.jar and xercesImpl.jar are included with this release. They are provided for convenience. They may be used by including them in the JVM classpath. Alternative JAXP implementations may be substituted.

A samples directory provides code samples and data together with a README file explaining compilation/running.

Getting Started

The most basic use of the API involves using a factory method to create a comparator or combiner object, and then invoking its compare() method:

 File inA= new File("a.xml");
 File inB= new File("b.xml");
 File delta= new File("a-to-b.xml");
 try {
   XMLComparator comparator= XMLComparatorFactory.newInstance().newXMLComparator(); StreamSource(inA),
                      new StreamSource(inB),
                      new StreamResult(delta));
 } catch (DeltaXMLException dxe) {
   // Process exceptions.

Properties and Features

Properties and Features are used to configure a XMLComparator or a XMLCombiner through the comparator.setProperty, comparator.setFeature, combiner.setProperty and combiner.setFeature methods as appropriate.

The currently supported properties and features are documented in Features and Properties.

Multi-threaded Use

A single XMLComparator or XMLCombiner should not be used by multiple threads running concurrently. Different XMLComparators or XMLCombiners may be used concurrently by different threads.

Feature, property and error-listener settings are preserved between XMLComparator and XMLCombiner invocations. Although it is possible to use a XMLComparator or XMLCombiner multiple times, doing so will increase its memory footprint, as a certain amount of dictionary data is preserved or interned between compare or combine invocations. While there are some performance advantages in reuse scenarios, we currently recommend that XMLComparators and XMLCombiners are not used multiple times unless you understand their memory consumption characteristics. A future release may provide more control and support for different reuse scenarios.

Support Information

Please visit our Support Page to find the relevant channels to use for any questions, bug-reports, suggested enhancements or any other matter related to this software.

Skip navigation links

Copyright © 2001-2018 DeltaXML Ltd. All Rights Reserved.