XMLUnit for Java 2.9.1 API
XMLUnit for Java is separated into several jars:
xmlunit-core
contains all algorithms and classes needed to validate XML, perform XPath queries or compare two pieces of XML.xmlunit-matchers
contains Hamcrest matchers on top ofxmlunit-core
. While the code is compiled against Hamcrest 1.x the resulting artifact is supposed to work with Hamcrest 2.x as well.xmlunit-assertj
contains AssertJ assertions on top ofxmlunit-core
that work with AssertJ 2.x and 3.x.xmlunit-assertj3
contains AssertJ 3.x assertions on top ofxmlunit-core
that work with AssertJ 3.18.1 and later.xmlunit-placeholders
- an experimental component that uses an extensible DSL inside of the control document to simplify certain special cases for comparisons.xmlunit-jakarta-jaxb-impl
provides a JAXBInput
builder that uses version 3.x of Jakarta XML Binding rather than it predecessor that uses thejavax.xml.bind
package (and is supported byxmlunit-core
directly).
While XMLUnit is focussed on testing, parts of it may be useful
in different contexts as well. The DifferenceEngine
may be the driver behind a
visual XML diff tool for example.
The main use case of XMLUnit is comparing XML generated by the
code under test with some known source of "good XML". This is
the responsibility of the DifferenceEngine
and its main (currently sole)
implementation DOMDifferenceEngine
.
Sometimes a full comparison is more than is needed in which
case only parts of the generated document are validated using
XPaths. This is the responsibility of XPathEngine
and its implementation JAXPXPathEngine
.
The validation
package contains everything needed to validate documents against
XML Schema (or even the schema document itself) or a DTD. Based
of JAXP's validation package the JAXPValidator
class should be able to
validate against different schema languages as well if you
provided it with the needed implementations.
The builder package contains fluent builders that may provide an API that is more convenient to use in many cases.
xmlunit-legacy
provides an API
compatible to XMLUnit for Java 1.x that is implemented on top of
XMLUnit Core.
XMLUnit for Java 2.6.0 adds a new experimental
component xmlunit-placeholders
that aims to provide
a small DSL for configuring the test engine via the control XML
document rather than code. The initial code base only supports a
placeholder of ${xmlunit.ignore}
to be used in
order to make XMLUnit ignore the element containing this
sequence.
XMLUnit for Java is licensed under the Apache License, Version 2.0. The legacy jar uses the three clause BSD license, the same license as XMLUnit for Java 1.x did.
jakarta.xml.bind
package.javax.xml.bind
package.DifferenceEngine
that is
at the heart of all comparisons as well as supporting interfaces
and implementations.Source
implementations.${xmlunit.KEYWORD}
sequences
inside the control document.