title: Comparing XML files and generate an output containing only differences
body: <p>I would like to produce a XML file that contain differences between two XML files.  Deleted elements should be ignored and elements might be in random order between files.</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/aa302294.aspx" rel="nofollow">Microsoft XML Diff tool</a> produces a diff gram but I would rather have the actual XML elements. XMLPatch from XML Diff Tool is not suitable since it applies the diff gram on the source XML to produce the exact file we used to produce the diff gram.</p>
  
  <p>Comparing <em>source.xml</em> with <em>actual.xml</em> should produces <em>desired.xml</em></p>
  
  <p><strong>source.xml</strong></p>
  
  <pre><code>&lt;products&gt;
     &lt;product&gt;
        &lt;name&gt;foo&lt;/name&gt;
        &lt;price&gt;10&lt;/price&gt;
     &lt;/product&gt;
     &lt;product&gt;
        &lt;name&gt;bar&lt;/name&gt;
        &lt;price&gt;20&lt;/price&gt;
     &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p><strong>actual.xml</strong></p>
  
  <pre><code>&lt;products&gt;
     &lt;product&gt;
        &lt;name&gt;foo&lt;/name&gt;
        &lt;price&gt;15&lt;/price&gt;
     &lt;/product&gt;
     &lt;product&gt;
        &lt;name&gt;bar&lt;/name&gt;
        &lt;price&gt;20&lt;/price&gt;
     &lt;/product&gt;
     &lt;product&gt;
        &lt;name&gt;toto&lt;/name&gt;
        &lt;price&gt;30&lt;/price&gt;
     &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p><strong>desired.xml</strong></p>
  
  <pre><code>&lt;products&gt;
     &lt;product&gt;
        &lt;name&gt;foo&lt;/name&gt;
        &lt;price&gt;15&lt;/price&gt;
     &lt;/product&gt;
     &lt;product&gt;
        &lt;name&gt;toto&lt;/name&gt;
        &lt;price&gt;30&lt;/price&gt;
     &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p>How can I implement this?</p>