HI,
I am trying to use my own comparator, but i get an exception, and i have not seen any example code using overrideDifferenceListener in the source code.
The code sample looks fine though without the stack trace you are getting it's hard to see what the cause of the problem might be. The class IgnoreTextAndAttributeValuesDifferenceListener provides an example comparator (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/src/java/org/custommonkey/xmlunit/IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup), and the junit test class for it (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/tests/java/org/custommonkey/xmlunit/test_IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup) has an example of its usage.
Hope this helps,
Tim
timbacon@users.sourceforge.net
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI,
I am trying to use my own comparator, but i get an exception, and i have not seen any example code using overrideDifferenceListener in the source code.
My code looks like this:
FileReader resfiler = null;
FileReader resfiler_exp = null;
...
try {
Diff diff = XMLUnit.compare(resfiler, resfiler_exp);
diff.overrideDifferenceListener(new DifferenceWithoutDates());
assertTrue("Different XML result", diff.identical());
// assertTrue("Different XML result", XMLUnit.compare(resfiler, resfiler_exp).identical());
Is there anything wrong in that code?
thanks
The code sample looks fine though without the stack trace you are getting it's hard to see what the cause of the problem might be. The class IgnoreTextAndAttributeValuesDifferenceListener provides an example comparator (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/src/java/org/custommonkey/xmlunit/IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup), and the junit test class for it (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/xmlunit/xmlunit/tests/java/org/custommonkey/xmlunit/test_IgnoreTextAndAttributeValuesDifferenceListener.java?rev=1.1&content-type=text/vnd.viewcvs-markup) has an example of its usage.
Hope this helps,
Tim
timbacon@users.sourceforge.net
Tim,
I had coded my comparator looking at the example. Anyway, my code was not working properly, now it is, thanks.