A.2. Changes from XMLUnit 1.1 to 1.2

A.2.1. Breaking Changes

  • If XMLUnit detects that it cannot match a certain node (i.e. it encounters a CHILD_NODE_NOT_FOUND kind of difference) the XPath for the "missing" node will be null. It used to be some random XPath of a different node.
  • XMLUnit.setIgnoreDiffBetweenTextAndCDATA now also sets DocumentBuilderFactory.setCoalescing. This has been done so that whitespace differences can be resolved according to the corresponding flags even in the presence of CDATA sections. Issue 1903923.
  • Two protected methods in SimpleXPathEngine (which you shouldn't extend anyway) have added XpathException to their throws list.

A.2.2. New Features

  • The SAXParserFactory used by Validator can now be configured completely. Issue 1903928.
  • A new class org.custommonkey.xmlunit.jaxp13.Validator can be used to validate schema definitions and schema instances using the javax.xml.validation package of JAXP 1.3. Depending on your JAXP implementation this may allow you to validate documents against schema definitions written in RELAX NG or other schema languages in addition to W3C XML Schema. See Section 4.4, “JAXP 1.3 Validation” for details.
  • DifferenceListener can now "upgrade" recoverable differences to non-recoverable by returning RETURN_UPGRADE_DIFFERENCE_NODES_DIFFERENT in the differenceFound method. Issue 1854284.
  • A new callback interface MatchTracker is now notified on successful matches of Nodes. For more details see Section 3.6, “MatchTracker. Issue 1860491.
  • It is now possible to have more control over whether the parser expand entity references or not by using XMLUnit.setExpandEntityReferences, see Section 3.8.5, “Entity Reference Expansion”. Issue 1877458.
  • New examples have been added:
    • RecursiveElementNameAndTextQualifier - a more flexible ElementQualifier that fills the same need as MultiLevelElementNameAndTextQualifier See Section 3.4.4, “org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier for more details.
    • CaseInsensitiveDifferenceListener a - DifferenceListener that ignores case when comparing texts.
    • FloatingPointTolerantDifferenceListener a - DifferenceListener that tries to parse texts as floating point numbers and compares them using a configurable tolerance.

A.2.3. Important Bug Fixes

  • If XMLUnit couldn't match nodes (i.e. it encountered a CHILD_NODE_NOT_FOUND kind of difference), the XPath expressions of the node details have been random. Issue 1860681.