| java.lang.Object org.custommonkey.xmlunit.Diff
All known Subclasses: org.custommonkey.xmlunit.DetailedDiff,
Diff | public class Diff implements DifferenceListener,ComparisonController(Code) | | Compares and describes any difference between XML documents.
Two documents are either:
- identical: the content and sequence of the nodes in the documents
are exactly the same
- similar: the content of the nodes in the documents are the same,
but minor differences exist e.g. sequencing of sibling elements, values of
namespace prefixes, use of implied attribute values
- different: the contents of the documents are fundamentally
different
The difference between compared documents is contained in a message buffer
held in this class, accessible either through the 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
DetailedDiff the DetailedDiff class can be used
instead.
Examples and more at xmlunit.sourceforge.net
|
Constructor Summary | |
public | Diff(String control, String test) | public | Diff(Reader control, Reader test) | public | Diff(Document controlDoc, Document testDoc) | public | Diff(String control, Transform testTransform) | public | Diff(InputSource control, InputSource test) | public | Diff(DOMSource control, DOMSource test) | public | Diff(Document controlDoc, Document testDoc, DifferenceEngine comparator) | public | Diff(Document controlDoc, Document testDoc, DifferenceEngine comparator, ElementQualifier elementQualifier) | protected | Diff(Diff prototype) Construct a Diff from a prototypical instance. |
Diff | public Diff(Document controlDoc, Document testDoc)(Code) | | Construct a Diff that compares the XML in two Documents
|
Diff | protected Diff(Diff prototype)(Code) | | Construct a Diff from a prototypical instance.
Used by extension subclasses
Parameters: prototype - a prototypical instance |
appendMessage | public StringBuffer appendMessage(StringBuffer toAppendTo)(Code) | | Append the message from the result of this Diff instance to a specified
StringBuffer
Parameters: toAppendTo - specified StringBuffer with message appended |
compare | final protected void compare()(Code) | | Top of the recursive comparison execution tree
|
differenceFound | public int differenceFound(Difference difference)(Code) | | DifferenceListener implementation.
If the
Diff.overrideDifferenceListener overrideDifferenceListener
method has been called then the interpretation of the difference
will be delegated.
Parameters: difference - a DifferenceListener.RETURN_... constant indicating how thedifference was interpreted. Always RETURN_ACCEPT_DIFFERENCE if the call is not delegated. |
haltComparison | public boolean haltComparison(Difference afterDifference)(Code) | | ComparisonController implementation.
Parameters: afterDifference - 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 |
identical | public boolean identical()(Code) | | Return the result of a comparison. Two documents are considered
to be "identical" if they contain the same elements and attributes
in the same order.
|
overrideDifferenceListener | public void overrideDifferenceListener(DifferenceListener delegate)(Code) | | Override the DifferenceListener used to determine how
to handle differences that are found.
Parameters: delegate - the DifferenceListener instance to delegate handling to. |
overrideElementQualifier | public void overrideElementQualifier(ElementQualifier delegate)(Code) | | Override the ElementQualifier used to determine which
control and test nodes are comparable for this difference comparison.
Parameters: delegate - the ElementQualifier instance to delegate to. |
similar | public boolean similar()(Code) | | Return the result of a comparison. Two documents are considered
to be "similar" if they contain the same elements and attributes
regardless of order.
|
skippedComparison | public void skippedComparison(Node control, Node test)(Code) | | DifferenceListener implementation.
If the
Diff.overrideDifferenceListener overrideDifferenceListener
method has been called then the call will be delegated
otherwise a message is printed to System.err .
Parameters: control - Parameters: test - |
toString | public String toString()(Code) | | Get the result of this Diff instance as a String
result of this Diff |
|
|