Release Documentation

XML Compare Samples ReadMe

1. Introduction

Comparisons in XML Compare are typically performed using either the Pipelined Comparator or the Document Comparator. Both of these comparators can be configured and customized with additional filters through their respective APIs. Alternatively, the Pipelined Comparator can be customized via an XML file, referred to as a 'DXP', while the Document Comparator can be customized via a 'DCP' XML file.

Many of the samples here demonstrate how the same feature can be implemented using either the Pipelined or Document Comparator; other samples are dedicated to showing the use of just one of the comparator types. In some cases, the alternative comparator may have no equivalent feature. The Document Comparator, for example, has a built-in feature for 'formatting elements', it is therefore just this comparator that is used in the 'Formatting Element Changes' sample. Please see the Choosing the Comparator section of the User guide for further details.

2. Table of Samples

SampleDC‑API*PC‑API*DXP*DCP*

Character by Character

Explains how character by character comparison can be performed, following the main Word By Word enabled comparison.

  

Comparing Orderless Elements

Explains how and why to instruct XML Compare to treat XML data as an orderless set of elements.

  

Detecting and Handling Moves

An example pipeline showing how to post-process a delta file to detect and mark data that has been moved.

 

Formatting Element Changes

Explains why inline formatting elements need special processing in order to minimize the impact that changing them has on the result file.

 

Ignoring Changes and Creating a Merged Document

An example pipeline showing how to post-process a delta result to "ignore" certain changes.

  

Numeric Tolerances

An example pipeline showing how to post-process a delta file to allow for tolerances when comparing numerical data.

   

Using Keys with Ordered Data

Explains when and how to add DeltaXML 'keys' to your input data in order to have more control over the matching process

   

XInclude and XML Compare

An example pipeline that instructs the XML parser to process XInclude statements before passing the input data to XML Compare.

  

Word By Word Text Comparison

An explanation of how to perform a detailed comparison on textual changes using filters included with XML Compare.

 

Folding DiffReport with DCP

An example Document Comparator Pipeline (DCP) based comparison. Also serves as a demonstration of the capabilities of the folding DiffReport output format.

   

DiffReport Sample Servlet

An example servlet showing how XML Compare could be used and deployed in a servlet engine or Java EE application server. Also serves as a multithreaded test case.

  

Image and Binary Comparison

An example that illustrates how referenced images and other binary resources can be compared.

  

Preserving Doctype information

Explains how to include doctype information in the result file that is determined by the input file doctype rather than hard-coded into the pipeline.

  

Preserving Entity References

Explains how to retain entity references in the comparison output.

   

Preserving Processing Instructions and Comments

Explains how to convert processing instructions and comments into XML markup (and back again) so that they are not removed by XML Compare.

  

Specifying a Comparison Pipeline

Explains how to set up a PipelinedComparator and also shows how DXP pipelines relate to our APIs using either Java or C# code.

  

Using a Catalog Resolver

A code sample to show how to instruct XML Compare to make use of catalog files.

   

Using Deltas for XML Versioning (diff and patch)

A simple code sample showing how to use a mixture of comparison and recombination demonstrating how XML Compare can be used manage XML versioning.

   

Using W3C DOM Documents

A simple code sample showing how to use in memory DOM structures as inputs/outputs.

   

Using XOM

A simple code sample showing how to use in memory XOM structures as inputs/outputs.

   
* Column Headings
Sample - Name and description
DC-API - Sample includes Document Comparator usage via API
PC-API - Sample includes Pipelined Comparator usage via API
DXP - Sample includes Pipelined Comparator usage via DXP file
DCP - Sample includes Document Comparator usage via DCP file

3. Other Sample Files

The following sample directories contain source code for you to use or adapt as necessary.

xsl-filters
Source code to various utility filters written in XSLT, many of which are used in the samples above.
dxp
Sample DXP pipeline configuration files, corresponding to the pipelines included in the XML Compare GUI and command-line processor by default. Also a DTD for ensuring DXP validity.
dcp
Sample DCP pipeline configuration files, corresponding to the pipelines included in the XML Compare GUI and command-line processor by default. Also annotated XML Schemas (for XML Schema v1.0 and 1.1) to assist with editing and ensure validity.