Hi I was wondering how I can ignore a line in XMLUnit
. For instance if I had the following tag which would always be different e.g file 1: 8 file 2: 10 and the rest of the file should match, how could I do this?
The sample code I was using is:
public class CommentDiffTest {
@Test
public void doTest() throws Exception{
FileReader fr1 = null;
FileReader fr2 = null;
try {
fr1 = new FileReader("file1.xml");
fr2 = new FileReader("file2.xml");
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println("ERROR FILES FOR COMPARISON COULD NOT BE FOUND!");
}
//Add init code here.
try {
Diff diff = new Diff(fr1, fr2);
System.out.println(diff.similar());
System.out.println(diff.identical());
DetailedDiff detDiff = new DetailedDiff(diff);
List<String> differences = detDiff.getAllDifferences();
for (Object object : differences) {
Difference difference = (Difference)object;
System.out.println("***********************");
System.out.println(difference);
System.out.println("***********************");
}
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}