When testing XML your application creates, simple string comparisons don’t cut it as there are many different ways the same XML content is serialized to a string. It doesn’t even stop with serialization as sometimes you don’t care for the order of XML elements and sometimes you do.
XMLUnit provides you with the tools to verify the XML you emit is the one you want to create. It provides helpers to validate against an XML Schema, assert the values of XPath queries or compare XML documents against expected outcomes.
The most important part is a diff-engine that provides you with full control over what kind of difference is important to you and which part of the generated document to compare with which part of your reference document.