How to Compare XML Files Using Diffxml

How to Compare XML Files Using Diffxml
Tips McGee
  October 06, 2006

Diffxml, a free utility for comparing xml files, was recommended from one user to another on the TestComplete message boards recently. Diffxml is a Java command-line tool setup to run on Linux/Unix and it’s not obvious how to use it on Windows. There are many programs like this that are designed for Linux but run fine on Windows if you know the steps to make them work.

I jumped into this one feet-first by installing Cygwin to run Unix utils on my PC and then converting the bash script included with diffxml so it would run correctly on Windows. That was more trouble than it was worth. It took a while to get the kinks worked out and the install was a bit complex with many steps.

Then I took a step back and converted the bash file to a DOS batch file which simplified things greatly.

Here are the steps to install and run diffxml on a Windows PC.

These steps are for a local user with admin rights.

 

  • Make sure you have a recent version of Java installed.
  • Download diffxml – choose the compiled tarball link to download diffxml-093A.tar.gz.
  • Extract the contents of diffxml-093A.tar.gz to “c:diffxml” or a new directory of your choice. (If your current archive extractor can’t handle gzip archives, download and install 7-Zip.)
  • Ok, diffxml is on your computer, now you need an example of how to run it.
  • Right-click on this link and save this file to your diffxml directory:
    diffxml.bat
  • If you installed diffxml to a different directory than c:diffxml then you’ll need to edit diffxml.bat to reflect the change.
  • Open a command line window and cd to your diffxml directory.
  • Type diffxml.bat and press Enter to diff the demonstration files.
  • If you don’t see an error then the output from diffxml should be in out1.xml.
  • Type out1.xml at the command prompt and press Enter to see the output from the xml diff in your browser.

Diffxml is now installed. You can edit diffxml.bat to see how to run diffxml and modify the batch file to take parameters.

Note: These steps use the compiled version of diffxml. There is a newer uncompiled version with major bug fixes available via SourceForge CVS.

You Might Also Like