Compare XML ignoring element order
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 doesn't have the mentioned method anymore. This is my current code: Diff diff = DiffBuilder.compare(expected) .withTest(actual) .ignoreComments() .ignoreWhitespace() .checkForSimilar() .build(); assertFalse(diff.hasDifferences()); Edit to Stefan Bodewigs comment: These are the two strings i compare with above snippet: String expected = "<root><foo>FOO</foo><bar>BAR</bar></root>"; String actual = "<root><bar>BAR</bar><foo>FOO</foo><