This package holds an implementation of a XML tree differencing algorithm. XML documents contain structured hierarchical data which conforms to a legal grammar. Differences in XML documents need to be expressed in a more meaningful form, than plain textual diffs. This implementation expresses the differences between various versions of a XML document, in terms of tree transformation operations applied to an in-memory DOM tree. The set of tree transformations include move, swap, insert, delete operations of the leaf nodes as well as sub-tree move, swap, insert, delete, internal node splitting, and internal node collapsing operations. Changes in attributes are expressed as well.  Please refer to the white paper "An efficient new differencing algorithm for structured hierarchical data" for a detailed discussion of the implementation details.

How to run

From the command prompt, one shall type
    $ java com.sun.xml.treediff.TreeDiff <file1.xml> <file2.xml>

Output

The differences are themselves expressed as a XML document.
 
A sample output
matchingPhase: 0.04
pruningPhase: 0.0
modificationPhase: 0.08
Total Time: 0.14

 <XMLTREEDIFF>
       <DEL>
             <NODE>
                     BOFile[1].BOArtifact[7].Interface[1]
             </NODE>
       </DEL>
       <INS>
             <NODE>
                     BOFile[1].BOArtifact[7].Interface[1]
             </NODE>
       </INS>
       <INS>
             <NODE>
                     BOFile[1].BOArtifact[7].Interface[1].Leaf{3}[0]
             </NODE>
             <DATA>
                 <NAME>
                       null
                 </NAME>
                 <VALUE>
                       long
                 </VALUE>
             </DATA>
        </INS>
 </XMLTREEDIFF>