XML is often used to represent engineering, scientific, or financial data where numeric values are important. Sometimes small changes in these values are not significant and you want to focus on the values that are. We’ll go through how you can indicate numeric tolerances with XML Data Compare.

Numeric Data

I used the magnetic field calculator from NOAA to determine the magnetic data for my location for two dates one month apart.  This is the result of the comparison:

Marking Insignificant Changes

You might decide that changes in the total intensity are only significant when greater than 5nt.  Adding these lines to the config file gives the result you want:

<dcf:location name="totalintensity-tolerance" xpath="//totalintensity">
  <dcf:numeric tolerance="5" use="A">

Per the attribute use=”A”, the result takes the value from the “A” file.

More Examples

See our web page Numeric Tolerances for a general discussion of this feature including more examples of element tolerances and using XPaths to identify numeric values.

There is a range of samples available on Bitbucket demonstrating various features of XML Data Compare.

XML in Publishing: The Challenges and Opportunities of Change in XML Documents