Menu > Logiciels / XML Tools / XML Diff


xmldiff is a simple command line tool to demonstrate libxmldiff functionnalities.


Download the win32 binaries (v0.2.5). You will need libxml2 DLLs.
Linux : xmldiff is shipped as a demonstrative program with libxmldiff. Please go to the libxmldiff download section to download source or Linux binaries.

Please see the libxmldiff page for changelog.

Other usefull software :
XML Tree Nav, xmldiff graphical viewer.
Download the XML Diff Tree View program (Win32 binary only)
Download the GUI launcher binary to have a basic GUI support (with xmldiff.gui included)

What ?

XMLDiff aims at providing efficient diff on XML files. See libxmldiff for full features list.

How expensive is it ?

These programs are released under the GPL license. It allows you to use the program at no charge, and freely adapt the provided source code to your needs.

How to use ?

Command Line

Command Line Quick Help

xmldiff v0.2.4 - (c) 2004 - Remi Peyronnet -
xmldiff - diff two XML files. (c) 2004-2006 - Rémi Peyronnet
Syntax : xmldiff action [options] <parameters>

 - diff <before.xml> <after.xml> <output.xml>
 - merge <before.xml> <after.xml> <output.xml>
 - xslt <style.xsl> <input.xml> <output.xml> [param='value']
 - recalc <before.xml> <after.xml>
 - execute <script.xds> (xds = list of these commands)
 - load <filename> <alias>
 - save <filename> <alias>
 - close <alias> / discard <alias> (same as close without saving)
 - flush
 - options
 - print <string>
 - delete <from alias> <xpath expression>
 - dup(licate) <source alias> <dest alias>
 - rem(ark),#,--,;,// <remark>
 - print_configuration

Global Options : 
  --auto-save yes      : Automatically save modified files
  --force-clean no     : Force remove of blank nodes and trim spaces
  --no-blanks yes      : Remove all blank spaces
  --pretty-print yes   : Output using pretty print writer
  --optimize no        : Optimize diff algorithm to reduce memory (see doc)
  --use-exslt no       : Allow the use of extended functions.
  --savewithxslt yes   : Save with <xsl:output> options the results of XSLT.
  --verbose 4          : Verbose level, from 0 (nothing) to 9 (everything).

Diff Options : 
  --ids '@id,@value'   : Use these item to identify a node
  --ignore '@ignore,..': Ignore differences on these items
  --diff-only no       : Do not alter files, just compare.
  --keep-diff-only no  : Keep only different nodes.
  --before-values yes  : Add before values in attributes or text nodes
  --sep |              : Use this as the separator
  --tag-childs yes     : Tag Added or Removed childs
  --merge-ns yes       : Create missing namespace on top of document
  --diff-ns http://... : Namespace definition, use no to disable
  --diff-xmlns diff    : Alias to use, use no to disable
  --diff-attr status   : Name of attribute to use (should not be used in docs)

Basic examples

Aliases and other commands

load / save / discard / flush / close / options / remark are useless from the command line, but are designed to be used in scripts.

All these function uses aliases to access xml files. Aliases are references to xml files. You can specify alias names with the load command. When you use an alias which does not exist, xmldiff tries to load the file and creates the corresponding alias.

Typically in "load file.xml alias; diff alias file2.xml out.xml", when processing the diff command, xmldiff will take the "alias" alias as is, as it has previsouly been opened by the load command, and will load file2.xml ans create a "file2.xml" alias, as the file was not previously loaded. It will output the result in the alias out.xml. If --auto-save is set, the alias "out.xml" will be save to a "out.xml" file.

If you understood the previous paragraph you can use aliases to make your code easier to read. If not, just use them as standard file names, it works too :-)


XML Diff introduces scripting capabilities to make xslt transformation, differences computations, basic xml manipulation (nodes deletion,...) in a same environment, with higher performance as usual scripting (as xml files do not have to be saved / loaded each times).

A script is called by the execute command. Several arguments can be used in the script ('$1' to '$8'). All the commands / options described in the previous section can be used here. Here is a simple script sample :

# Script sample
options --auto-save no --optimize no

print "Pre-Processing..."
load $1 Before
xslt pre-processing.xsl Before Before
load $2 After
xslt pre-processing.xsl After After

diff Before After Diff
discard Before
discard After

xslt post-processing.xsl Diff Diff
save $3 Diff

print "Done."

GUI Support

GUI is provided by the versatile GUI Launcher tool. A launcher configuration file is included in the main distribution for diff operations only.

XML Tree Nav

Check out XML Tree Nav to have a graphical representation of XML Diff files. This tool provides an easy browsing of xml diff files : icons represent the diff status : '+' means 'added', '-' means 'removed', '?' means that there is a modification in the child items, and a yellow block shows an element with a modification. In the modified item, the values before and after are provided : "before|after".

A button in the toolbar can be used to show only modified items : unchanged items will be hidden. This is very useful for files where there are only few differences.

Screenshot of the UI

Valid CSS! Haut de Page / Top of the page [ Mini Lien ]   [ Nav ]   [ Menu ]   [ Mirrors ] © 2000-2014 Rémi Peyronnet. /~remi/soft/xml/xmldiff/xmldiff_en.php3. (19/03/2006)