Compare XML Files

You can use MATLAB® Report Generator™ software to compare a pair of XML text files.

The XML comparison tool processes the results into a report that you can use to explore the file differences.

You can access the XML comparison tool from:

  • The MATLAB Current Folder browser context menu

  • The MATLAB command line.

The XML comparison tool compares the files using the "Chawathe" algorithm, as described in this paper:

Change Detection in Hierarchically Structured Information, Sudarshan Chawathe, Anand Rajaraman, and Jennifer Widom; SIGMOD Conference, Montreal, Canada, June 1996, pp. 493-504.

This conference paper is based upon work published in 1995: see

XML comparison reports display in the Comparison Tool. For more information about the Comparison Tool, see Comparing Files and Folders in the MATLAB documentation.

The XML comparison report shows a hierarchical view of the portions of the two XML files that differ. The report does not show sections of the files that are identical.

If the files are identical you see a message reporting there are no differences.

    Note:   It might not be possible for the analysis to detect matches between previously corresponding sections of files that have diverged too much.

Change detection in the Chawathe analysis is based on a scoring algorithm. Items match if their Chawathe score is above a threshold. The MATLAB Report Generator implementation of Chawathe's algorithm uses a comparison pattern that defines the thresholds. For more information, see How the Matching Algorithm Works.

For information about creating and using XML comparison reports, see:

  1. How to Compare XML Files

  2. Explore the XML Comparison Report

Was this topic helpful?