Document Comparator Features and Properties Reference

Document Comparator Features and Properties Reference

The Document Comparator provides a set of document comparison features configurable via the Java API or DCP (Document Comparator Pipeline) files. For a full description of all configuration options, extension points, and capabilities see the Comparator Type Reference.


DocumentComparator Properties

The comparison engine used in several Compare API packages has a number of configuration properties and features which affect the behaviour of the comparison/alignment process. This document lists all of the available properties and features and also describes the various ways in which they can be used (in API code and DXP files).

The configuration technique is modelled on the properties and features configuration mechanism provided by the Java JAXP interfaces for XML/SAX parser and XSLT transformer configuration. One of the motivations for JAXP was to provide a pluggable parser and transform implementations so that, for example, users could swap between Xerces and Aelfred, for Xalan-J and Saxon by using runtime configuration. Having a late-bound configuration mechanism using properties and features supports the run-time configuration of the processors.

DeltaNova XML uses this metaphor when creating our first Java APIs and we still provide this mechanism. We now also provide some early-bound method calls in addition to properties and features as these provide better type safety and API usability, particularly when using an IDE.

Using Features and Properties

Compare APIs provide a number of methods for feature and property configuration. In the following table we will document the various set methods, there are also corresponding get methods. See the API documentation for further details.

Runtime

Package / Namespace

Class and method

Java




com.deltaxml.core

PipelinedComparator.setParserFeature(String, boolean)



PipelinedComparator.setParserProperty(String, Object)


com.deltaxml.core

DocumentComparator.setParserFeature(String, boolean)



DocumentComparator.setParserProperty(String, Object)


com.deltaxml.core

DataComparator.setParserFeature(String, boolean)



DataComparator.setParserProperty(String, Object)

In addition to these methods, our later pipeline-oriented APIs also include other methods for setting properties and features on other components within the pipeline such as the parser and serializer. These methods have similar names and signatures such as setParserFeature, setOutputProperty, and setTransformerConfigurationOption.

Our DXP/DCP/DTCP declarative pipeline definition languages include XML elements for comparator configuration. Further details are included in the DXP Pipeline Overview.

List of Features

The following sections list the available features. When 'PipelinedComparator' is used within 'Applies to' sections below this means it can be used in the Java com.deltaxml.core package.

isFullDelta

Full name:

http://deltaxml.com/api/feature/isFullDelta

True:

A full delta containing both the differences and the similarities between the two input trees is produced

False:

A standard (differences only) delta is produced

Default value:

true

Applies to:

XMLComparator, PipelinedComparator

deltaV2

This feature has been deprecated in version 11.0.0.

Full name:

http://deltaxml.com/api/feature/deltaV2

True:

Causes the newer version 2 delta format to be generated. Recommended for all new users.

False:

A backwards-compatible (version 1) delta is produced.

Default value:

true

Applies to:

XMLComparator, XMLCombiner, PipelinedComparator, PipelinedComparatorS9

enhancedMatch1

Full name:

http://deltaxml.com/api/feature/enhancedMatch1

True:

A modified comparison algorithm tailored to documents is used, giving better matching results particularly when used with word-by-word filtering.

False:

A backwards-compatible (pre release 4.x) matching algorithm is used

Default value:

true

Applies to:

XMLComparator, PipelinedComparator, PipelinedComparatorS9

isCombineForward

Full name:

http://deltaxml.com/api/feature/isCombineForward

True:

A standard forward combination is performed.

False:

A reverse combination is performed.

Default value:

true

Applies to:

XMLCombiner

outputHeaderComment

Full name:

http://deltaxml.com/api/feature/outputHeaderComment

True:

A comment is added to the output recording use of Compare and the inputs used.

False:

No comment is added to the output.

Default value:

true

Applies to:

XMLComparator, XMLCombiner, PipelinedComparator, PipelinedComparatorS9

List of Properties

Properties are more complex settings than features — the value is an Object rather than a boolean. When 'PipelinedComparator' is used within 'Applies to' sections below this means it can be used in the Java com.deltaxml.core package.

orderlessPresentation

Full name:

http://deltaxml.com/api/property/orderlessPresentation

Java Field:

PipelinedComparator.ORDERLESS_PRESENTATION

Java value type:

java.lang.String

Default value:

a_matches_deletes_adds

Applies to:

XMLComparator, PipelinedComparator

String values:

  • a_matches_deletes_adds — output presented with all A matches, then deletes (A-only elements), then adds (B-only elements).

  • a_adds — all elements from A appear in result order, followed by adds from B.

  • b_matches_adds_deletes — output presented with all B matches, then adds, then deletes.

  • b_deletes — all elements from B appear in result order, followed by deletes from A.


PipelinedComparator Properties

The PipelinedComparator class provides a modern, high-performance comparison API based on Saxon's s9api interfaces. See the Configuration Properties page for the full list of configuration options applicable to PipelinedComparator.