title: compare xml files using python
body: <p>I want to compare these two xml files:</p>
  
  <p>File1.xml:</p>
  
  <pre><code>&lt;ngs_sample id="40332"&gt;
    &lt;workflow value="salmonella" version="101_provisional" /&gt;
    &lt;results&gt;
    &lt;gastro_prelim_st reason="not novel" success="false"&gt;
        &lt;type st="1364" /&gt;
        &lt;type st="9999" /&gt;
    &lt;/gastro_prelim_st&gt;
   &lt;/results&gt;
  &lt;/ngs_sample&gt;
  </code></pre>
  
  <p>File2.xml:</p>
  
  <pre><code>&lt;ngs_sample id="40332"&gt;
    &lt;workflow value="salmonella" version="101_provisional" /&gt;
    &lt;results&gt;
    &lt;gastro_prelim_st reason="not novel" success="false"&gt;
        &lt;type st="1364" /&gt;
     &lt;/gastro_prelim_st&gt;
   &lt;/results&gt;
  &lt;/ngs_sample&gt;
  </code></pre>
  
  <p>I've used <code>xmldiff</code> to compare a.xml with b.xml: </p>
  
  <pre><code>def compare_xmls(observed,expected):
  
      from xmldiff import main, formatting
      formatter = formatting.DiffFormatter()
      diff = main.diff_files(observed,expected,formatter=formatter)
      return diff
  
  out = compare_xmls(a.xml, b.xml)
  print(out)
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <pre><code>[delete, /ngs_sample/results/gastro_prelim_st/type[2]]
  </code></pre>
  
  <p>Anyone know how to identify what is the difference between the two xml files, i.e. what has been deleted compared to the file b.xml. Anyone recommend any other way of comparing xml files in python?</p>