Technical Specification

 Table of Contents

1. Overview

XML Data Compare compares two well-formed XML data files, an 'old' file, identified as 'A' and an 'updated' file, identified as 'B', and generates an XML file describing the differences between the two files. The file representing the differences is known as a delta file. The comparison also takes a configuration file along with input files which can be used to customise the comparison.

The XML Data Compare software provides a REST interface which can be embedded in other software to compare elements and attributes of two well-formed XML 1.0 documents.

2. Customising the comparison

XML Data Compare takes a configuration file which is used to customise the the comparison.  The configuration file has three main elements : defaults, locations and output. The defaults show the document-wide settings.  Any settings used against a sub-tree of the main document will override the default. Whereas, the location element defines the sub-tree where the contained settings apply. The output element defines the output format of the comparison. XML Data Compare provides two different output types, deltaV2 and side by side folding diff-report. 

This configuration file uses XPath to identify elements or attributes so that different settings can be defined for them. There are some restrictions while using the XPath in the configuration file. They are as follows:

  • An XPath 3.1 compatible 'match' pattern must be used.
  • The ',' comma XPath separator operator can only be used in sub-expressions.
  • The context item for the evaluation of the XPath is the XML document node (i.e. not the root element)
  • Expressions should start with a '/'
  • XPaths defined inside location elements are all relative to the location's XPath

3. Data Comparison

While comparing the two XML data files, the XML Data Compare considers the tree structure of the files and identifies the corresponding elements in the two files. Corresponding elements will have the same element local name and namespace and will have corresponding parent elements. The root elements of the two files must have the same local name and namespace. 

XML Data Compare has the following features which can be applied to a comparison using the configuration file:

  • Word by word comparison
  • Ordered/Unordered comparison
  • Ignoring changes to elements and attributes
  • Whitespace normalisation
  • Numeric tolerance
  • Two different forms of deltaV2 output: With full context or changes-only differences.

4. Output Formats

4.1. Delta Files

A DeltaXML delta file normally represents the set of differences between two files along with unchanged data, including any unchanged elements and attributes. A DeltaXML delta file has the same basic structure as the files that have been compared, with some additional attributes and elements. An XML namespace (the DeltaXML namespace) distinguishes these additional elements and attributes from those found in the input files.

4.2. Side by side folding diff-report

XML Data Compare provides the inbuilt support for rendered HTML output to highlight differences. This result is a side by side result having formatted XML syntax with folding points highlighted. A simple toolbar along with a 'breadcrumb' view of the currently selected change is shown above the folding view in the DiffReport, there is also a 'Differences List' shown as a vertical panel alongside.

Optionally, the output formats have the support for showing only differences between the two files. This can be defined in the configuration file.

#content .code