From: Stefan B. <bo...@ap...> - 2011-09-22 14:14:55
|
On 2011-09-16, Rajesh Ajjarapu wrote: > I am using these two classes to ignore the nodes for comparision in xml > unit. I am unsuccessful still to eliminate the element with City. I'm sorry, but your code snippets are more or less unreadable. Any chance you can strip them down to the essentials and get rid of all formatting? You seem to have pasted the xmlUnitutility class twice but didn't paste the Ignoreelement class. > Ignoreelement ie = new Ignoreelement(ignore); > Diff diff = new Diff(fr1, fr2); > DetailedDiff detDiff = new DetailedDiff(diff); > List differences = detDiff.getAllDifferences(); > for (Object object : differences) { > Difference difference = (Difference)object; > DifferenceEngine engine = new DifferenceEngine(diff); You don't do anything with this instance > ie.differenceFound(difference); what do you expect this to do? You ignore the return code. > // diff.overrideDifferenceListener(ie); > System.out.println("***********************"); > System.*out*.println(difference); > System.out.println("***********************"); > } Your DifferenceListener has not been used during comparisions so you can't ignore anything here. You must set the DifferenceListener before the comparision is performed. In you case this is before you invoke diff.similar() or detDiff.getAllDifferences(). Stefan |