Class NewDifferenceEngine

All Implemented Interfaces:
DifferenceConstants, DifferenceEngineContract

public class NewDifferenceEngine extends Object implements DifferenceConstants, DifferenceEngineContract
Class that has responsibility for comparing Nodes and notifying a DifferenceListener of any differences or dissimilarities that are found. Knows how to compare namespaces and nested child nodes, but currently only compares nodes of type ELEMENT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_TYPE_NODE, PROCESSING_INSTRUCTION_NODE and TEXT_NODE. Nodes of other types (eg ENTITY_NODE) will be skipped.
See Also:
  • Constructor Details

  • Method Details

    • setMatchTracker

      public void setMatchTracker(MatchTracker matchTracker)
      Specified by:
      setMatchTracker in interface DifferenceEngineContract
      matchTracker - the instance that is notified on each successful match. May be null.
    • compare

      public void compare(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier)
      Entry point for Node comparison testing.
      Specified by:
      compare in interface DifferenceEngineContract
      control - Control XML to compare
      test - Test XML to compare
      listener - Notified of any differences detected during node comparison testing
      elementQualifier - Used to determine which elements qualify for comparison e.g. when a node has repeated child elements that may occur in any sequence and that sequence is not considered important.
    • toDifference

      public static Iterable<Difference> toDifference(Comparison comp)
      Maps a Comparison to Differences.
      comp - comparison to map
    • toNodeDetail

      public static NodeDetail toNodeDetail(Comparison.Detail detail)
      Maps node details.
      detail - XMLUnit 2.x detail
      XMLUnit 1.x detail