Compare XML files for differencies with XML Diff Tool
How to effectively compare and merge contents of the XML(VML, RELS, HTML) files with xlCompare
What is xlCompare?
xlCompare is a tool that compares and merges Excel files for differences (Excel Diff Tool). However, you can use it to compare other types of the documents and XML format is one of the supported file formats. In addition to XML, xlCompare works with VML and RELS files - because they contain XML data inside.
How we process XML files
You may ask reasonable question: xlCompare is a xl comparator, how can it work with XML files.
XML file is a text document, that contains tags, their attributes and sub items organized into hierarchical structure. So, tree control is an ideal solution to represent contents of the XML file.
From the other side, Excel worksheet doesn't have tree control, but it allows you to group rows on the worksheet and to create outlined documents. Excel is an extremely feature rich application, that allows to show data, organized into tree-like structure.
xlCompare uses this method and loads contents of the XML file into worksheet and creates outline you can use to collapse tags to simplify navigation.
As you know XLSX file inside is a collection of the zipped XML files, that represent worksheet cells, drawing objects, chart objects and other parts of the Excel workbook. For our development process XML file comparison is an important part as we need to compare contents of the XML files inside XLSX documents.
In this article we'll use two XML documents, that represent worksheets in the XLSX file and its saved copy.
Look into the image below, it contains XML file opened in the xlCompare application.
Left side of the document contains outline. Right part - worksheet, with option Display Gridlines turned off, displays contents of the XML document.
Tags are highlighted with Bold font.
Attributes and their text values are highlighted with text color.
Excel workbook gives you a few features you can use to work with outlined data:
- Click on the heading to expand\collapse all tags on the specific level
- Click on the plus\minus button on the left side to expand\collapse only specific tag
Data in the root XML node looks incomplete.
This is because cell in column B doesn't have enough room to display all text. Just expand column B to see full name of the attribute.
As you see Excel workbook is a flexible solution to display contents of the XML files.
Excel workbook is adopted to contain a huge amount of data, so if your XML file is large - xlCompare will open is faster than other XML viewers.
Other methods to view XML files
What are the common methods to view contents of the XML files?
Windows offers you Microsoft Edge browser to open XML file:
If you google for XML Viewer applications, you can find Microsoft XML Notepad. Good application to view contents of the XML files.
Unfortunately, both applications doesn't have an option to compare XML files.
Open and compare XML files
Now we are ready to open and compare two XML files for differences. Below is a step-by-step instruction on how to compare XML files by using xlCompare tool.
- Start xlCompare application from the shortcut on your desktop
- Drop two XML files from the Windows Explorer into the xlCompare Window
- Get the color-coded difference report
This image shows comparison results for two XML files.
Working with results
How to work with comparison results provided by xlCompare.
Color-coded comparison report
All the differences found between left and right panels are highlighted with color.
New tags and attributes, that appear in the left panel are highlighted with green background.
New tags and attributes in the right panel are highlighted with red background.
In the example above outlinePr tag, that represents Outline Properties has been moved down and placed below the tabColor tag.
Besides that, outlinePr tag is present on the both panels, it is highlighted by xlCompare. Order of the nodes may important, that's why this type of modification is detected and highlighted by xlCompare.
Changed values are highlighted with yellow color. Also, xlCompare shows original and modified value in the same place.
In this example dimension tag has changed attribute ref. Used Range on the worksheet was changed from A1:Q531 to A1:Q454.
Below the report xlCompare gives you summary of the comparison. This is structured list that contains all differences found between the XML files, grouped by type.
Use quick merge buttons to merge tags from left file to right and vice versa.
All the commands you can use to merge Excel files are applicable to XML files. So you can move every row from the left file to the right one.
Options you need to know
What options you need to know to compare XML files.
Left and right panels in the xlCompare display outlined structure of the opened XML files.
When this option enabled, all nodes in the left and right panels are collapsed and expanded synchronously.
This is very useful option when you are working with files, that have similar structure.
Exclude Hidden Rows
How to exclude some branches from the comparison?
Just collapse them and exclude hidden rows from comparison.
Use this option when you need to exclude some data that produces comparison noise.
Some characters in your XML documents are not important? Ignore them in the options and get more clear results.
Command line option -one_panel
If you like how xlCompare opens XML files, you can associate it in the Windows Explorer with XML documents.
In this case xlCompare opens only one document, so right panel is always empty. Hide it by modifying registry key.
Command line options
xlCompare is a feature rich Excel diff tool, that covers all aspects of the comparing Excel files. It has a command line mode you can use to integrate xlCompare as external diff viewer into SVN\GIT tools.
All of these features are applicable to XML files. So, you can use xlCompare to compare and merge XML files from the command line.
xlCompare is a diff viewer for XML files, that you can use with your SVN\GIT tools.
Conclusion: Reasons to choose xlCompare as XML Diff Tool
Quick and easy to use solution.This tool was designed to be as easy and convenient to use as possible. Do not spend your time learning its features. Just drop your files and get the results.
Error free solution.Manual comparison has a risk of mistake, that could be negative for your business. xlCompare is a tool, that was tested on the thousands of computers and millions of files. With xlCompare you are protected from errors in the XML file comparison.
xlCompare saves your time and resources.You are spending your time to compare XML files manually or using text comparators, that doesn't show outlined structure. This reflects in wasting your working time and losing productivity, that it the most important resource in the modern time. With xlCompare you will save your time and money.
xlCompare makes complex things simple!