| java.lang.Object org.custommonkey.xmlunit.DifferenceEngine
DifferenceEngine | public class DifferenceEngine implements DifferenceConstants(Code) | | 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.
Examples and more at xmlunit.
sourceforge.net
See Also: DifferenceListener.differenceFound(Difference) |
Inner Class :final protected static class DifferenceFoundException extends Exception | |
Method Summary | |
public void | compare(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) Entry point for Node comparison testing.
Parameters: control - Control XML to compare Parameters: test - Test XML to compare Parameters: listener - Notified of any Difference differences detectedduring node comparison testing Parameters: elementQualifier - Used to determine which elements qualify forcomparison e.g. | protected void | compare(Object expected, Object actual, Node control, Node test, DifferenceListener listener, Difference difference) If the expected and actual values are unequal then inform the listener of
a difference and throw a DifferenceFoundException. | protected void | compareAttribute(Attr control, Attr test, DifferenceListener listener) | protected void | compareCDataSection(CDATASection control, CDATASection test, DifferenceListener listener) | protected void | compareComment(Comment control, Comment test, DifferenceListener listener) | protected void | compareDocument(Document control, Document test, DifferenceListener listener, ElementQualifier elementQualifier) | protected void | compareDocumentType(DocumentType control, DocumentType test, DifferenceListener listener) | protected void | compareElement(Element control, Element test, DifferenceListener listener) | void | compareElementAttributes(Element control, Element test, NamedNodeMap controlAttr, NamedNodeMap testAttr, DifferenceListener listener) | protected void | compareHasChildNodes(Node control, Node test, DifferenceListener listener) Compare the number of children, and if the same, compare the actual
children via their NodeLists. | protected void | compareNode(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) First point of call: if nodes are comparable it compares node values then
recurses to compare node children. | protected boolean | compareNodeBasics(Node control, Node test, DifferenceListener listener) | protected void | compareNodeChildren(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) Compare the number of children, and if the same, compare the actual
children via their NodeLists. | protected void | compareNodeList(NodeList control, NodeList test, int numNodes, DifferenceListener listener, ElementQualifier elementQualifier) Compare the contents of two node list one by one, assuming that order
of children is NOT important: matching begins at same position in test
list as control list. | protected void | compareNodeList(List controlChildren, List testChildren, int numNodes, DifferenceListener listener, ElementQualifier elementQualifier) Compare the contents of two node list one by one, assuming that order
of children is NOT important: matching begins at same position in test
list as control list. | protected void | compareProcessingInstruction(ProcessingInstruction control, ProcessingInstruction test, DifferenceListener listener) | protected void | compareRecognizedXMLSchemaInstanceAttribute(Attr control, Attr test, DifferenceListener listener) | protected void | compareText(Text control, Text test, DifferenceListener listener) | protected void | compareText(CharacterData control, CharacterData test, DifferenceListener listener) | static List | nodeList2List(NodeList nl) Returns the NodeList's Nodes as List, taking ignoreComments
into account. | final static String | normalizeWhitespace(String orig) Replace all whitespace characters with SPACE and collapse
consecutive whitespace chars to a single SPACE. |
compare | public void compare(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier)(Code) | | Entry point for Node comparison testing.
Parameters: control - Control XML to compare Parameters: test - Test XML to compare Parameters: listener - Notified of any Difference differences detectedduring node comparison testing Parameters: elementQualifier - Used to determine which elements qualify forcomparison e.g. when a node has repeated child elements that may occurin any sequence and that sequence is not considered important. |
compare | protected void compare(Object expected, Object actual, Node control, Node test, DifferenceListener listener, Difference difference) throws DifferenceFoundException(Code) | | If the expected and actual values are unequal then inform the listener of
a difference and throw a DifferenceFoundException.
Parameters: expected - Parameters: actual - Parameters: control - Parameters: test - Parameters: listener - Parameters: differenceType - throws: DifferenceFoundException - |
compareAttribute | protected void compareAttribute(Attr control, Attr test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two attributes
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareCDataSection | protected void compareCDataSection(CDATASection control, CDATASection test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two CDATA sections - unused, kept for backwards compatibility
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareComment | protected void compareComment(Comment control, Comment test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two comments
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareDocument | protected void compareDocument(Document control, Document test, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException(Code) | | Compare two Documents for doctype and then element differences
Parameters: control - Parameters: test - Parameters: listener - Parameters: elementQualifier - throws: DifferenceFoundException - |
compareDocumentType | protected void compareDocumentType(DocumentType control, DocumentType test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two DocumentType nodes
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareElement | protected void compareElement(Element control, Element test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare 2 elements and their attributes
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareHasChildNodes | protected void compareHasChildNodes(Node control, Node test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare the number of children, and if the same, compare the actual
children via their NodeLists.
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareNode | protected void compareNode(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException(Code) | | First point of call: if nodes are comparable it compares node values then
recurses to compare node children.
Parameters: control - Parameters: test - Parameters: listener - Parameters: elementQualifier - throws: DifferenceFoundException - |
compareNodeBasics | protected boolean compareNodeBasics(Node control, Node test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compares node type and node namespace characteristics: basically
determines if nodes are comparable further
Parameters: control - Parameters: test - Parameters: listener - true if the nodes are comparable further, false otherwise throws: DifferenceFoundException - |
compareNodeChildren | protected void compareNodeChildren(Node control, Node test, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException(Code) | | Compare the number of children, and if the same, compare the actual
children via their NodeLists.
Parameters: control - Parameters: test - Parameters: listener - Parameters: elementQualifier - throws: DifferenceFoundException - |
compareNodeList | protected void compareNodeList(NodeList control, NodeList test, int numNodes, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException(Code) | | Compare the contents of two node list one by one, assuming that order
of children is NOT important: matching begins at same position in test
list as control list.
Parameters: control - Parameters: test - Parameters: numNodes - convenience parameter because the calling method shouldknow the value already Parameters: listener - Parameters: elementQualifier - used to determine which of the child elements inthe test NodeList should be compared to the current child element in thecontrol NodeList. throws: DifferenceFoundException - |
compareNodeList | protected void compareNodeList(List controlChildren, List testChildren, int numNodes, DifferenceListener listener, ElementQualifier elementQualifier) throws DifferenceFoundException(Code) | | Compare the contents of two node list one by one, assuming that order
of children is NOT important: matching begins at same position in test
list as control list.
Parameters: control - Parameters: test - Parameters: numNodes - convenience parameter because the calling method shouldknow the value already Parameters: listener - Parameters: elementQualifier - used to determine which of the child elements inthe test NodeList should be compared to the current child element in thecontrol NodeList. throws: DifferenceFoundException - |
compareProcessingInstruction | protected void compareProcessingInstruction(ProcessingInstruction control, ProcessingInstruction test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two processing instructions
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareRecognizedXMLSchemaInstanceAttribute | protected void compareRecognizedXMLSchemaInstanceAttribute(Attr control, Attr test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare two attributes
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareText | protected void compareText(Text control, Text test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare text - unused, kept for backwards compatibility
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
compareText | protected void compareText(CharacterData control, CharacterData test, DifferenceListener listener) throws DifferenceFoundException(Code) | | Compare text
Parameters: control - Parameters: test - Parameters: listener - throws: DifferenceFoundException - |
nodeList2List | static List nodeList2List(NodeList nl)(Code) | | Returns the NodeList's Nodes as List, taking ignoreComments
into account.
|
normalizeWhitespace | final static String normalizeWhitespace(String orig)(Code) | | Replace all whitespace characters with SPACE and collapse
consecutive whitespace chars to a single SPACE.
|
|
|