Skip to Main Content Skip to Search
Product Documentation

Explore the XML Comparison Report

Navigate the XML Comparison Report

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 toolbar or the XML menu. To move to the next or previous group of changes, either:

You can also click to select items in the hierarchical trees.

Report item highlighting indicates the nature of each difference as follows:

Type of report itemHighlightingNotes
ModifiedPinkModified 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.
UnmatchedGreenWhen you select an unmatched item it is highlighted in a box in one tree only.
ContainerNoneRows with no highlighting indicate a container item that contains other modified or unmatched items.

Hierarchical nodes appear twice because the container node and the contents can have separate differences in their properties. This feature of the XML report allows you to distinguish between property differences of the node itself, and differences contained within nodes nested inside.

Use the toolbar buttons or the Comparison menu for the following functions:

See also XML Comparison Examples.

Unexpected Results

If you see unexpected results within an XML comparison report, try reading the documentation section on How the Matching Algorithm Works.

Save Comparison Log Files in a Zip File

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:

xmlcomp.zipTempFiles('c:\work\myexportfolder')

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:

xmlcomp.showLogFile

Export Results to the Workspace

To export the XML comparison results to the MATLAB base workspace, click the toolbar button Export to Workspace, or select File > Export to Workspace. 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.EditsDescription
FiltersArray of filter structure arrays. Each structure has two fields, Name and Value.
LeftFileNameFile name of left file exported to XML.
LeftRootxmlcomp.Node object that references the root of the left tree.
RightFileNameFile name of right file exported to XML.
RightRootxmlcomp.Node object that references the root of the right tree.
TimeSavedTime when results exported to the workspace.
VersionMathWorks® release-specific version number of xmlcomp.Edits object.

Property of xmlcomp.NodeDescription
ChildrenArray of xmlcomp.Node references to child nodes, if any.
EditedBoolean — If Edited = true then the node is either inserted (green) or part of a modified matched pair (pink).
NameName of node.
ParametersArray of parameter structure arrays. Each structure has two fields, Name and Value.
Parentxmlcomp.Node reference to parent node, if any.
PartnerIf matched, Partner is an xmlcomp.Node reference to the matched partner node in the other tree. Otherwise empty [].

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS