Is there a way in XMLUnit 2 to make these two documents return as the same (or similar)? I can do some preprocessing to get the child nodes, but I wanted to see if this could be done directly with XMLUnit.
Doc1:
<a><b><c>test</c></b></a>
Doc2:
<c>test</c>
No, XMLUnit expects to be given the roots of the trees that it is supposed to compare. Once you pick the child node, you can use Input.fromNode
or a similar approach - but you knew that.
It wouldn't be terribly difficult to extend the input builder or create a Source
wrapper to enable the selection of the "real root" via XPath or similar means, but there is no built-in solution right now.