Posted 15 November 2019
by DeltaXignia

Share this blog:

Read more in Product How-tos

Comparing Config Files with XML Data Compare

Telephone Config Files

Configuration files generally include settings for the system they are designed for. At DeltaXignia 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:

FILE A

File-A-Config.png

FILE B

File-B-Config-1.png

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:

Changes-found.png

The config file used to ignore the differences was this:







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‘:

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'

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.

© 2000-2025 DeltaXML Ltd. registered in England and Wales (Company No. 2528681), trading as DeltaXignia. All rights reserved