Compare XML files and find the difference

Compare two XML files and present results in a form of tree. XML diff tool for developers. Supported file formats XML, VML, RELS, HTML.
Compare XML files for differences with xlCompare
Compare XML files in xlCompare

Compare XML files step-by-step

Let's try to compare two XML files and investigate the results.

Start xlCompare application

On the application screen you see two worksheets, that is a bit unusual. Do not take it into account, as this is Excel file comparison tool.
xlCompare window

Drop your XML files from the Windows Explorer right into xlCompare window

xlCompare identifies XML data and opens it in the XML viewer. It is absolutely different from the Excel worksheet window.
XML file opened in the xlCompare application
Now you can browse all the nodes and attributes in your files.

xlCompare uses following coloring rules:

  • every element(tag) receives green icon and foreground color
  • attribute has a label icon and brown text
  • value of the attribute has blue foreground color
  • attribute font and value is shown with italic font to increase contrast
  • value of the element (not of the attribute) is named #text and has black color
  • if your file contains comments, that are shows with green text color, this is default rule for most of the code editors, like Microsoft Visual Studio

After second file is dropped, comparison is started automatically

You don't need to start it manually. However, you can start is using Compare Files command on the Home tab on Ribbon, or using F6 hotkey.

xlCompare notifies you about count of found differences

Count of the differences between 2 xml files
After closing this message window you are getting to the comparison report.
Comparison report for two XML files

Highlighting differences in XML files

To point you to the differences found in XML files xlCompare expands ALL elements that contains different sub-elements or different attributes or values.
Like to the XML viewer window comparison results receives following formatting:

Bold element icon

This element contains changes inside in its attributes or subitems. Or this element was added into this file and is not present in the other file.
In additional to icon changed elements receives bold font.

New XML elements

Every new element, that was not found in the other file receives background color in addition to the bold icon and font.
New elements in the left panel are highlighted with green color and new elements in the right panel receive red formatting.
Changed XML element highlighted with color

Changed attributes

Every changed attribute receives orange background, blue label icon and bold font.

New attributes

New attribute, that is not present in the corresponding file receives green background color for the left panel and red color for the right panel.
This color scheme is standard for the many file comparators. We are using these colors to highlight changes in the Excel files. You can change them in the options if you prefer to see other colors.
Changed attribute highlighted with icon and color

Synchronized XML Trees

xlCompare performs synchronization of compared XML trees. Matching elements are put on the same level. Right panel is a base panel for alignment. If order of the elements doesn't match, order is taken from the right panel.
For every new node corresponding tree receives empty space, where missed element is shown with strike font.
This alignment is ideal for synchronous browsing. You always see matching elements on the same level.

What was changed in value

Imagine you've got a orange colored attribute, that means that it was changed. How to find what was changed exactly? Should you copy 2 nodes to notepad? No, just put your mouse over this string. xlCompare will give you a tooltip with detailed information about relative path to this element and changed values. If string values was changed xlCompare highlights changed characters in both values.
Tooltip window in the xml file

How to expand and collapse nodes

Both XML trees and expanded and collapsed synchronously. When you expand one element, corresponding element in the other tree is also expanded.
Right click menu allows you to expand all elements in tree or only elements in the specific branch.
To expand specific branch of XML elements you can use Ctrl+Left\Right Arrow keys. This hotkey expands or collapses the whole branch in single click.
Context menu in the xml file

List of differences in XML files

Although all found differences are highlighted in the report, xlCompare give you a complete list of all the changes found in XML files.
Use Display Results command on the Home tab on the Ribbon.
On the bottom part of xlCompare you are getting Difference Explorer window.
This is structured list with all differences we've found.
On the left of this list there is a Difference Legend that shows how many differences of each type report contains.
List of differences in two xml files

Compare XML files ignoring order of attributes

Is order of the attributes and elements important?

This depends on the usage of your XML files. For most of our projects this is important because it is important for Excel application.
From the other side, it may not be important for you. For example for the options file, that is stored in the XML format order of the elements can be ignored.

How to ignore order of elements

By default, order of the elements is not ignored. And you are getting green and red lines for the mismatched attributes.

Use Ignore Order push button on the XML tab on the Ribbon.

Ignore order button on the XML tab
When this button is pushed – order is ignored.
Below you see examples of the elements compared with order ignored and with order that is important.
Order of xml elements is important
Order of xml elements is important
Order of xml elements is ignored
Order of xml elements is ignored

Options for XML comparison

xlCompare has a lot of options that manages comparison of Excel files, but only a few of them are applicable to the XML comparison.

On the Rules tab in the Options you can change for following:

Ignore case in comparing string values.
Ignore specific characters.

View tab in the Options

Synchronize Selection option defines is trees are expended synchronously.

Command Line mode

xlCompare allows to be integrated into the third-party applications that require difference viewer for XML files.
For this purpose, the application has command like interface that is standard for the most of diff tools.

Compare three XML files

xlCompare has an option for 3-way comparison. You can compare three XML files that have the same base version.
Use command 3-Files on the Home tab on the Ribbon. It enabled third panel for 3-rd Excel file.
BASE (common) version is opened in the central panel and used as primary panel to synchronize the compared XML files.
Compare three xml files for differences

Using xlCompare as viewer for XML files

xlCompare can be used as viewer for XML files.
You can create an association in the Windows Explorer for xlCompare and XML files.
Typically, this is done by using Open With command in the context menu.

Open XML without right panel

After you open XML document from Windows Explorer with xlCompare, you get your file in the Left panel. While right panel is empty and not used, when browsing contents of the XML document.

1. Open Registry Editor

Press Start button and start typing regedit. Windows will suggest you Registry Editor Application.

2. Expand following key

Computer\HKEY_CLASSES_ROOT\Applications\xlCompare.exe\shell\open\command
You need to expand tree items in the left panel of Registry Editor.

3. Modify the command

Double click on the (Default) label, and add -one-panel command line switch to the value.
Result should look like this:
"C:\Program Files\Spreadsheet Tools\xlCompare\xlCompare.exe" -one_panel "%1"
Now xlCompare opens your XML file with right panel hidden and looks like any other XML viewer.

What is the # column in XML view

Probably you already noticed that there is an # column in the XML view.
It contains relative order of this element in the parent XML element.
When is it needed? One of our cases:
Imagine that you cell in Excel has style formatting with ID=67.
So, you are opening style.xml and looking for 67-th XF element in the cellXfs branch.
With # column, it is very easy to locate 67-th element in tree.
Hope this example clearly explains importance of this column.

I have a question about xlCompare

Please, describe your question or inquiry in the form below. We will be happy to respond you!
Go to top