public class NewDifferenceEngine extends java.lang.Object implements DifferenceConstants, DifferenceEngineContract
Modifier and Type | Class and Description |
---|---|
private static class |
NewDifferenceEngine.CompareUnmatchedNodeMatcher |
static class |
NewDifferenceEngine.ComparisonController2ComparisonController |
static class |
NewDifferenceEngine.DifferenceListener2DifferenceEvaluator |
static class |
NewDifferenceEngine.ElementQualifier2ElementSelector |
private static class |
NewDifferenceEngine.IgnoreDoctypeNotPresentDifferences |
private static class |
NewDifferenceEngine.IsBetweenDocumentNodeAndRootElement
Tests whether the DifferenceEngine is currently processing
comparisons of "things" between the document node and the
document's root element (comments or PIs, mostly) since these
must be ignored for backwards compatibility reasons.
|
static class |
NewDifferenceEngine.MatchTracker2ComparisonListener |
Modifier and Type | Field and Description |
---|---|
private ComparisonController |
controller |
private static java.util.Map<java.lang.Class<? extends ElementQualifier>,ElementSelector> |
KNOWN_SELECTORS |
private MatchTracker |
matchTracker |
private static java.lang.Integer |
ZERO |
ATTR_NAME_NOT_FOUND, ATTR_NAME_NOT_FOUND_ID, ATTR_SEQUENCE, ATTR_SEQUENCE_ID, ATTR_VALUE, ATTR_VALUE_EXPLICITLY_SPECIFIED, ATTR_VALUE_EXPLICITLY_SPECIFIED_ID, ATTR_VALUE_ID, CDATA_VALUE, CDATA_VALUE_ID, CHILD_NODE_NOT_FOUND, CHILD_NODE_NOT_FOUND_ID, CHILD_NODELIST_LENGTH, CHILD_NODELIST_LENGTH_ID, CHILD_NODELIST_SEQUENCE, CHILD_NODELIST_SEQUENCE_ID, COMMENT_VALUE, COMMENT_VALUE_ID, DOCTYPE_NAME, DOCTYPE_NAME_ID, DOCTYPE_PUBLIC_ID, DOCTYPE_PUBLIC_ID_ID, DOCTYPE_SYSTEM_ID, DOCTYPE_SYSTEM_ID_ID, ELEMENT_NUM_ATTRIBUTES, ELEMENT_NUM_ATTRIBUTES_ID, ELEMENT_TAG_NAME, ELEMENT_TAG_NAME_ID, HAS_CHILD_NODES, HAS_CHILD_NODES_ID, HAS_DOCTYPE_DECLARATION, HAS_DOCTYPE_DECLARATION_ID, NAMESPACE_PREFIX, NAMESPACE_PREFIX_ID, NAMESPACE_URI, NAMESPACE_URI_ID, NO_NAMESPACE_SCHEMA_LOCATION, NO_NAMESPACE_SCHEMA_LOCATION_ID, NODE_TYPE, NODE_TYPE_ID, PROCESSING_INSTRUCTION_DATA, PROCESSING_INSTRUCTION_DATA_ID, PROCESSING_INSTRUCTION_TARGET, PROCESSING_INSTRUCTION_TARGET_ID, SCHEMA_LOCATION, SCHEMA_LOCATION_ID, TEXT_VALUE, TEXT_VALUE_ID
Constructor and Description |
---|
NewDifferenceEngine(ComparisonController controller)
Simple constructor that uses no MatchTracker at all.
|
NewDifferenceEngine(ComparisonController controller,
MatchTracker matchTracker)
Simple constructor
|
Modifier and Type | Method and Description |
---|---|
void |
compare(org.w3c.dom.Node control,
org.w3c.dom.Node test,
DifferenceListener listener,
ElementQualifier elementQualifier)
Entry point for Node comparison testing.
|
void |
setMatchTracker(MatchTracker matchTracker) |
static java.lang.Iterable<Difference> |
toDifference(Comparison comp) |
private static java.lang.Iterable<Difference> |
toDifference(Difference d) |
static NodeDetail |
toNodeDetail(Comparison.Detail detail) |
private static final java.lang.Integer ZERO
private static final java.util.Map<java.lang.Class<? extends ElementQualifier>,ElementSelector> KNOWN_SELECTORS
private final ComparisonController controller
private MatchTracker matchTracker
public NewDifferenceEngine(ComparisonController controller)
controller
- the instance used to determine whether a Difference
detected by this class should halt further comparison or notComparisonController.haltComparison(Difference)
public NewDifferenceEngine(ComparisonController controller, MatchTracker matchTracker)
controller
- the instance used to determine whether a Difference
detected by this class should halt further comparison or notmatchTracker
- the instance that is notified on each
successful match. May be null.ComparisonController.haltComparison(Difference)
,
MatchTracker.matchFound(Difference)
public void setMatchTracker(MatchTracker matchTracker)
setMatchTracker
in interface DifferenceEngineContract
matchTracker
- the instance that is notified on each
successful match. May be null.public void compare(org.w3c.dom.Node control, org.w3c.dom.Node test, DifferenceListener listener, ElementQualifier elementQualifier)
compare
in interface DifferenceEngineContract
control
- Control XML to comparetest
- Test XML to comparelistener
- Notified of any differences
detected
during node comparison testingelementQualifier
- 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.private static java.lang.Iterable<Difference> toDifference(Difference d)
public static java.lang.Iterable<Difference> toDifference(Comparison comp)
public static NodeDetail toNodeDetail(Comparison.Detail detail)