I have the xmlunit-1.6.jar file under the Project->Settings->Library Management. I’m trying to add
"“import org.xmlunit.diff.DefaultNodeMatcher;” to one of my Keywords. All other xmlunit imports are compiling but for import org.xmlunit.diff.DefaultNodeMatcher, I’m getting the following error.
Groovy:unable to resolve class org.xmlunit.diff.DefaultNodeMatcher
Am I missing a jar file or some setting? Please advise.
import org.custommonkey.xmlunit.XMLAssert;strong text
Do you need this line? I guess, you don’t. Why not you just remove it?
If I do that I can’t use the method DefaultNodeMatcher in the following code. It shows as red error.
I need to use this method to compare the 2 XML files where the order can be ignored. If you look at the two files below, you’ll see in the first file Id F00001 comes first and in the second file D00002 comes first. Earlier I tried using xmlunit’s DifferenceListener, but that fails because the order of JobInfo wasn’t the same. After searching it online, I thought I try the ElementSelectorys methods to see if that would work.
Thanks, any advise will be appreciated.
Diff myDiff = DiffBuilder.compare(fr1).withTest(fr2).withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))
// File 1
// File 2
If you search the Maven Central Repository for the keyworkd “xmlunit”, you will find multiple repositories whose name include “xmlunit”.
You wrote that you have got
xmlunit-1.6.jar; which is possible this one: https://mvnrepository.com/artifact/xmlunit/xmlunit/1.6. This jar only contains the
org.xmlunit.diff package is included in https://mvnrepository.com/artifact/org.xmlunit/xmlunit-core/2.8.2
Now I am curious why you want to use 2 different “xmlunit” libraries mixed. Do you find these 2 libraries are functionary insufficient so that you need both? Are you sure?
thanks, let me try to see if I can download 2.8.2 and if that would solve my problem. I don’t want to use both libraries, I’m assuming once I’ve the 2.8.2, I would no longer need the 1.6. Like I said earlier 1.6(xmlunit alone didn’t not solve my problem of comparing the two xml files and ignoring the order).