Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

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'

# 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:

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