org.custommonkey.xmlunit
public class Diff extends Object implements DifferenceListener, ComparisonController
appendMessage
or toString
methods. NB: When comparing documents, the
comparison is halted as soon as the status (identical / similar / different)
is known with certainty. For a list of all differences between the documents
an instance of the DetailedDiff class
can be used
instead.
Constructor Summary | |
---|---|
Diff(String control, String test)
Construct a Diff that compares the XML in two Strings | |
Diff(Reader control, Reader test)
Construct a Diff that compares the XML read from two Readers | |
Diff(Document controlDoc, Document testDoc)
Construct a Diff that compares the XML in two Documents | |
Diff(String control, Transform testTransform)
Construct a Diff that compares the XML in a control Document against the
result of a transformation | |
Diff(InputSource control, InputSource test)
Construct a Diff that compares the XML read from two JAXP InputSources | |
Diff(DOMSource control, DOMSource test)
Construct a Diff that compares the XML in two JAXP DOMSources | |
Diff(Document controlDoc, Document testDoc, DifferenceEngine comparator)
Construct a Diff that compares the XML in two Documents using a specific
DifferenceEngine | |
Diff(Document controlDoc, Document testDoc, DifferenceEngine comparator, ElementQualifier elementQualifier)
Construct a Diff that compares the XML in two Documents using a specific
DifferenceEngine and ElementQualifier | |
protected | Diff(Diff prototype)
Construct a Diff from a prototypical instance.
|
Method Summary | |
---|---|
StringBuffer | appendMessage(StringBuffer toAppendTo)
Append the message from the result of this Diff instance to a specified
StringBuffer |
protected void | compare()
Top of the recursive comparison execution tree |
int | differenceFound(Difference difference)
DifferenceListener implementation.
|
boolean | haltComparison(Difference afterDifference)
ComparisonController implementation. |
boolean | identical()
Return the result of a comparison. |
void | overrideDifferenceListener(DifferenceListener delegate)
Override the DifferenceListener used to determine how
to handle differences that are found. |
void | overrideElementQualifier(ElementQualifier delegate)
Override the ElementQualifier used to determine which
control and test nodes are comparable for this difference comparison. |
boolean | similar()
Return the result of a comparison. |
void | skippedComparison(Node control, Node test)
DifferenceListener implementation.
|
String | toString()
Get the result of this Diff instance as a String |
Parameters: prototype a prototypical instance
Parameters: toAppendTo
Returns: specified StringBuffer with message appended
overrideDifferenceListener
method has been called then the interpretation of the difference
will be delegated.Parameters: difference
Returns: a DifferenceListener.RETURN_... constant indicating how the difference was interpreted. Always RETURN_ACCEPT_DIFFERENCE if the call is not delegated.
Parameters: afterDifference
Returns: true if the difference is not recoverable and the comparison should be halted, or false if the difference is recoverable and the comparison can continue
DifferenceListener
used to determine how
to handle differences that are found.Parameters: delegate the DifferenceListener instance to delegate handling to.
ElementQualifier
used to determine which
control and test nodes are comparable for this difference comparison.Parameters: delegate the ElementQualifier instance to delegate to.
overrideDifferenceListener
method has been called then the call will be delegated
otherwise a message is printed to System.err
.Parameters: control test
Returns: result of this Diff