Comparing Config Files with XML Data Compare

Telephone Config Files

Configuration files generally include settings for the system they are designed for. At DeltaXML we sometimes want to compare the config files for different telephones to ensure that they are all set up in the same way. These config files include records of calls in elements with names starting callrecord. We might want to compare two config files from different phones but we’re not interested in the call history. We want to reduce the noise from this information that is never going to match.

First Comparison

A comparison with an empty config file (but with output to a folding diff report) shows 49 differences:



Adjust the Config File to Ignore Differences

Using a config file that ignores all elements with name starting callrecord where there is a difference reduces the number of differences to just three:

The config file used to ignore the differences was this:

<!--?xml version="1.0" encoding="UTF-8"?-->
<dcf:configuration xmlns:dcf="" xmlns:xsi="" xsi:schemalocation=" config.xsd" version="1.0" id="ignore-call-records">
  <dcf:location name="ignore-call-records" xpath="//*[starts-with(name(.), 'callrecord')]">
    <dcf:ignore-changes use="DELETE">
  <dcf:output format="sbs-folding-diffreport" changes-only="false">

If the elements that I wanted to ignore all had the same name (say ‘callrecord‘) then the location element required would look like this and would select all elements with a name of ‘callrecord‘:

<dcf:location name="ignore-call-records" xpath="//callrecord"></dcf:location>

There can be as many elements as required.  I could have had several elements, pointing to each of the different callrecord types (callrecord_missed_period, callrecord_missed_remote and so on.) The only restriction is that they should all have different name attribute values, for example ignore-call-record1ignore-call-record2 etc.

Explanation of XPath Expression

Breaking down the XPath expression //*[starts-with(name(.), 'callrecord')]

//* says to look at all elements.

The expression inside the square brackets is a predicate, applying a filter to the elements selected.  When the predicate evaluates to be true then the record is included and therefore ignored in the comparison.

The starts-with function expects two parameters, separated by a comma. The first says what we are looking at and the second specifies the characters that it should start with in order for the function to return true.

If you wish to re-use this expression for element names that start xyz then just replace 'callrecord' with 'xyz'

<dcf:location name="ignore-call-record" xpath="//*[starts-with(name(.), 'xyz')]"></dcf:location>

The ‘use’ Attribute

In this case, I have set the use attribute to “DELETE” because I didn’t want to see the changes.  If I had used “A” or “B” I would have seen the values from the file I had specified.  There are also options to keep the A version if it exists, otherwise, keep the B version (AB) and vice versa.

More Details

See our web page Ignore Changes for a general discussion of this feature.

There is a range of samples available on Bitbucket.

Keep Reading

Configuring XML Compare for Efficient XML Comparison

Define pipelines and fine-tune the comparison process with various configuration options for output format, parser features, and more.

A Beginner’s Guide to Comparing XML Files

With XML Compare, you receive more than just a basic comparison tool. Get started with the most intelligent XML Comparison software.

Introducing Character By Character Comparison

Find even the smallest differences in your documents with speed and precision with character by character comparison.

Everything Great About DeltaJSON

Accessible through an intuitive online GUI or REST API, DeltaJSON is the complete package for managing changing JSON data. Learn everything about makes DeltaJSON great.

Mastering Complex Table Comparisons Within Your Technical Documentation

Our software excels at presenting changes in complex tables and technical content.

Simplifying Your JSON Management Experience with DeltaJSON

DeltaJSON simplifies JSON data management with the introduction of an NPM package.

Navigating XML Change in Aviation

Discover how the aviation industry can effectively manage XML changes to ensure compliance and safety while enhancing operational excellence.

File Formats and ConversionQA Functionality

ConversionQA is a tool by DeltaXML ensuring the success of content conversion projects by comparing content from any two XML formats.

Never miss an update

Sign up to our newsletter and never miss an update on upcoming features or new products