XQuery/Compare two XML files

Motivation
You want to compare two XML files. If the files are the same you want to return a true and if not you want to return a false. Note if you want to see the differences see the ../XML Differences example.

Method
We will use the xdiff:compare function that comes built in to eXist. To use this you pass two nodes to the compare function:

xdiff:compare($node1 as node, $node2 as node)

Sample Source Code
Assume you have two different XML files

The result will be: