title: compare xml files by choosing specific tag name for comparison, list attribute difference of that specific tag
body: <p>Consider:</p>
  
  <pre><code>&lt;ParentTag&gt;
      &lt;Firstchild ID="id1" Title="title1"&gt;
          &lt;secondchild ID="" Title=""&gt;
              &lt;TagOfInterest ID="value1" Title=""/&gt;
              &lt;TagOfInterest ID="value2" Title=""/&gt;
              &lt;TagOfInterest ID="value3" Title=""/&gt;
          &lt;/secondchild&gt;
      &lt;/Firstchild&gt;
  &lt;/ParentTag&gt;
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>&lt;secondxml&gt;
      &lt;something ID="id1" Title="title1"&gt;
          &lt;anotherthing ID="" Title=""&gt;
              &lt;TagOfInterest ID="value1" Title=""/&gt;
              &lt;TagOfInterest ID="dinosaur" Title=""/&gt;
              &lt;TagOfInterest ID="nomore" Title=""/&gt;
          &lt;/anotherthing&gt;
      &lt;/something&gt;
  &lt;/secondxml&gt;
  </code></pre>
  
  <p>I'm using XML Unit, </p>
  
  <p>Req 1: comparison engine should compare <strong>only</strong> by tag name "tagofInterest".</p>
  
  <p>Req 2: Within that tag if difference exist, compare by attribute.</p>
  
  <p>Implementation which printed only tag names, but didn't give much control over tag of interest or difference by attribute within. Any better suggestion in the way of using XML Unit?</p>
  
  <pre><code>        fr1 = new FileReader(expectedXML);
          fr2 = new FileReader(actualXML);
          Diff diff = new Diff(fr1, fr2);
          DetailedDiff detDiff = new DetailedDiff(diff);
          detDiff.overrideMatchTracker(new MatchTrackerImpl());
          detDiff.overrideElementQualifier(new ElementNameQualifier());
          detDiff.getAllDifferences();
  
  
  
  
  class MatchTrackerImpl implements MatchTracker {
    public void matchFound(Difference difference) {
      if (difference != null) {
          NodeDetail controlNode = difference.getControlNodeDetail();
          NodeDetail testNode = difference.getTestNodeDetail();
          System.out.println(printNode(controlNode.getNode()));
          System.out.println(printNode(testNode.getNode()));
      }
  }
  
  private static String printNode(Node node) {
      if (node != null &amp;&amp; node.getNodeType() == Node.ELEMENT_NODE) {
          StringWriter sw = new StringWriter();
          try {
              Transformer t = TransformerFactory.newInstance().newTransformer();
              t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
              t.transform(new DOMSource(node), new StreamResult(sw));
          } catch (TransformerException te) {
              System.out.println("nodeToString Transformer Exception");
          }
          return sw.toString();
  
       }
      return null;
   }
  }
  </code></pre>