Documentation Center

  • Trial Software
  • Product Updates

How to Compare XML Files

Select Files to Compare

From the Current Folder Browser

To compare two files from the Current Folder browser:

  • For two files in the same folder, select the files, right-click and select Compare Selected Files/Folders.

  • To compare files in different folders:

    1. Select a file, right-click and select Compare Against

    2. Select the second file to compare in the Select Files or Folders for Comparison dialog box.

    3. Leave the default Comparison type, XML text comparison.

    4. Click Compare.

If the selected files are XML files, the XML comparison tool performs a Chawathe analysis on the files and displays a report in the Comparison Tool.

The file you right-click to launch the XML comparison tool displays on the right side of the report.

For more information about comparisons of other file types with the Comparison Tool, such as text, MAT or binary, see Comparing Files and Folders in the MATLAB® documentation.

From the Comparison Tool

To compare files using the Comparison Tool, from the MATLAB Toolstrip, in the File section, select the Compare button. In the dialog box select files to compare.

If the files you select to compare are XML files and you select an XML comparison, the XML comparison tool performs a Chawathe analysis of the XML files, and generates an report.

From the Command Line

To compare XML files from the command line, enter

visdiff(filename1, filename2)

where filename1 and filename1 are XML files. This XML comparison functionality is an extension to the MATLAB visdiff function.

Change Comparison Type

If you specify two XML files to compare using either the Current Folder Browser or the visdiff function, then the Comparison Tool automatically performs the default comparison type, XML text comparison.

To change comparison type, either create a new comparison from the Comparison Tool, or use the Compare Against option from the Current Folder browser. You can change comparison type in the Select Files or Folders for Comparison dialog box. If you want the MATLAB text differences report for XML files, change the comparison type to Text comparison in the dialog before clicking Compare.

XML Comparison Examples

For an example with instructions, see mlxml_testplanmlxml_testplan.

See Also

For an overview, see Compare XML Files.

For explanations on how to use and understand the report and the XML comparison functionality, see Explore the XML Comparison Report

Was this topic helpful?