Compare XML ignoring element order

前端 未结 1 401
情话喂你
情话喂你 2021-01-11 19:49

With XMLUnit 2 how do you compare two documents without taking the element order into account?

I got this question for XMLUnit 1, but apparently the new API in v2 do

相关标签:
1条回答
  • 2021-01-11 20:41

    One difference that may need to become clearer in the 2.x documentation is the default ElementSelector - roughly what used to be ElementQualifier in 1.x. Where 1.x defaults to match elements by name, 2.x defaults to match elements in order. Maybe this is a bad idea.

    Your Diff should work if you switch to matching on element names.

    .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byName))

    0 讨论(0)
提交回复
热议问题