|On this page…|
The XML comparison report shows changes only. The report is a hierarchical view of the differences between two XML text files, and is not a hierarchical view of the original XML data.
To step through differences, use the Comparison tab on the toolstrip. To move to the next or previous group of differences, on the Comparison tab, in the Navigate section, click the arrow buttons to go to the previous or next difference.
You can also click to select items in the hierarchical trees.
Selected items appear highlighted in a box.
If the selected item is part of a matched pair it is highlighted in a box in both left and right trees.
Report item highlighting indicates the nature of each difference as follows:
|Type of report item||Highlighting||Notes|
|Modified||Pink||Modified items are matched pairs that differ between the two
files. When you select a modified item it is highlighted in a box
in both trees.|
Changed parameters for the selected pair are displayed in a separate Parameters panel for review. If strings are too long to display in the Parameters table, right-click and select Compare as Text to open a new comparison of the parameters.
|Unmatched||Green||When you select an unmatched item it is highlighted in a box in one tree only.|
|Container||None||Rows with no highlighting indicate a container item that contains other modified or unmatched items.|
Use the toolbar buttons or the Comparison menu for the following functions:
Refresh — Run Chawathe analysis again to refresh the comparison report.
Swap Sides — Swap sides and rerun comparison. Runs the Chawathe analysis again.
Save As > Save as HTML — Opens the Save dialog box, where you can choose to save a printable version of the XML comparison report. The report is a noninteractive HTML document of the differences detected by the Chawathe algorithm for printing or archiving a record of the comparison.
Save As > Save to Workspace — Export XML comparison results to workspace.
In the Navigate section, click the arrow buttons (or press Up or Down keys) to go to the previous difference or go to the next difference.
Compare Selected Parameter — Open a new report for the currently selected pair of parameters. Use this when the report cannot display all the details in the Parameters pane, e.g., long strings or a script.
Use the View tab controls on the toolstrip for the following functions:
Expand All — Expands every item in the tree.
Collapse All — Collapses all items in the tree to the most compact view possible.
See also XML Comparison Examples.
If you see unexpected results within an XML comparison report, try reading the documentation section on How the Matching Algorithm Works.
Temporary XML comparison files accumulate in tempdir/MatlabComparisons/XMLComparisons/TempDirs/. These temporary files are deleted when you close the related comparison report.
You can zip the temporary files (such as log files) created during XML comparisons, for sharing or archiving. While the comparison report is open, enter:
The destination folder must exist. The output reports the zip file name:
Created the zipfile "c:\work\myexportfolder\20080915T065514w.zip"
To view the log file for the last comparison in the MATLAB® Editor, enter:
To export the XML comparison results to the MATLAB base workspace,
On the Comparison tab, in the Comparison section, select Save As > Save to Workspace.
The Input Variable Name dialog box appears.
Specify a name for the export object in the dialog and click OK. This action exports the results of the XML comparison to an xmlcomp.Edits object in the workspace.
The xmlcomp.Edits object contains information about the XML comparison including file names, filters applied, and hierarchical nodes that differ between the two XML files.
To create an xmlcomp.Edits object at the command line without opening the Comparison Tool, enter:
Edits = xmlcomp.compare(a.xml,b.xml)
|Property of xmlcomp.Edits||Description|
|Filters||Array of filter structure arrays. Each structure has two fields, Name and Value.|
|LeftFileName||File name of left file exported to XML.|
|LeftRoot||xmlcomp.Node object that references the root of the left tree.|
|RightFileName||File name of right file exported to XML.|
|RightRoot||xmlcomp.Node object that references the root of the right tree.|
|TimeSaved||Time when results exported to the workspace.|
|Version||MathWorks® release-specific version number of xmlcomp.Edits object.|
|Property of xmlcomp.Node||Description|
|Children||Array of xmlcomp.Node references to child nodes, if any.|
|Edited||Boolean — If Edited = true then the node is either inserted (green) or part of a modified matched pair (pink).|
|Name||Name of node.|
|Parameters||Array of parameter structure arrays. Each structure has two fields, Name and Value.|
|Parent||xmlcomp.Node reference to parent node, if any.|
|Partner||If matched, Partner is an xmlcomp.Node reference to the matched partner node in the other tree. Otherwise empty .|