Skip to content

Instantly share code, notes, and snippets.

@christianchristensen
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianchristensen/9613690 to your computer and use it in GitHub Desktop.
Save christianchristensen/9613690 to your computer and use it in GitHub Desktop.

XML Diff tools for the CLI

(also handy info for using with the git difftool)


Use the git-difftool(1): git difftool -x './diff-xmllint-c14n $LOCAL $REMOTE'

diff-xmllint-c14n.sh

#!/bin/bash
# git difftool helper for viewing textfile XML diffs
diff -u <(xmllint --c14n $1) <(xmllint --c14n $2)

A bit more sophisticated using the git built-in color mechanism:

#!/bin/bash
l=$(mktemp /tmp/temp.local.XXXX)
r=$(mktemp /tmp/temp.local.XXXX)

xmllint --c14n $1 > $l
xmllint --c14n $2 > $r
git diff --color-words --no-index $l $r

rm $l $r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment