Forum Discussion

PrathapR's avatar
PrathapR
Frequent Contributor
5 years ago
Solved

How to ignore nodes with It values when comparing two xmls with XMLUnit2

Comparing two xml files in soapui using groovy with XMLUnit2, Have some weird cases which are different in both files, but are acceptable. So have to ignore/skip those.   ResXML1: <alpha:Errors> ...
  • PrathapR's avatar
    PrathapR
    5 years ago

    Found solution for first part of the above question

    diff = DiffBuilder.compare(testxml)
    .withTest(resxml)
    .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.conditionalBuilder().whenElementIsNamed("ShiftAttribute").thenUse(ElementSelectors.byNameAndAttributes("ShiftAttributeCode")).elseUse(ElementSelectors.byName).build()))
    .build();