title: Finding differences in two XML files using XMLUnit
body: <p>How to check for only particular nodes and not all nodes for difference while using the DetailedDiff function of XMLUnit</p>
  
  <p>this is my code:</p>
  
  <pre><code>public static void main(String[] args) 
      {
          //URL url1 = xmlunittest.class.getResource("MSHIS1.xml");
      //  URL url2 = xmlunittest.class.getResource("MSHIS.xml");
  
          Logger L = new Logger();
  
          FileReader fr1 = null;
          int countofdifferences = 0;
          FileReader fr2 = null;
          try {
              fr1 = new FileReader("MSHIS.xml");
              fr2 = new FileReader("MSHIS1.xml");
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  
          try {
              Diff diff = new Diff(fr1, fr2);
              L.writeToBVTLOG("Similar? " + diff.similar());
              L.writeToBVTLOG("Identical? " + diff.identical());
  
  
              DetailedDiff detDiff = new DetailedDiff(diff);
              List differences = detDiff.getAllDifferences();
              for (Object object : differences) {
                  Difference difference = (Difference)object;
                  L.writeToBVTLOG("------------------------");
                  L.writeToBVTLOG(difference.toString());
                  L.writeToBVTLOG("------------------------");
  
                  countofdifferences++;
              }
  
          } catch (SAXException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
  
          L.writeToBVTLOG(countofdifferences);
      }
  </code></pre>
  
  <p>But the thing is that, I just want the program to tell me if 4 particular nodes have undergone any changes. So how to get there from listing all the differences.</p>