Package org.custommonkey.xmlunit
Class NodeTest
java.lang.Object
org.custommonkey.xmlunit.NodeTest
Encapsulation of the Node-by-Node testing of a DOM Document
Uses a nodetype-specific
NodeFilter
to pass the DOM Nodes
to a NodeTester instance that performs the acual Node validation.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Node type specific Node Filter: accepts Nodes of those types specified in constructor, rejects all others -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a NodeTest for the DOM built using the Reader and JAXPConstruct a NodeTest for the DOM built using the String and JAXPConstruct a NodeTest for the specified DocumentNodeTest
(DocumentTraversal documentTraversal, Node rootNode) Construct a NodeTest using the specified DocumentTraversal, starting at the specified root nodeNodeTest
(InputSource src) Construct a NodeTest for the DOM built using the InputSource. -
Method Summary
Modifier and TypeMethodDescriptionprivate static DocumentTraversal
getDocumentTraversal
(Document document) Try to cast a Document into a DocumentTraversalvoid
performTest
(NodeTester tester, short singleNodeType) Does this NodeTest pass using the specified NodeTester instance?void
performTest
(NodeTester tester, short[] nodeTypes) Does this NodeTest pass using the specified NodeTester instance?
-
Field Details
-
documentTraversal
-
rootNode
-
-
Constructor Details
-
NodeTest
Construct a NodeTest for the DOM built using the String and JAXP- Throws:
SAXException
IOException
-
NodeTest
Construct a NodeTest for the DOM built using the Reader and JAXP- Throws:
SAXException
IOException
-
NodeTest
Construct a NodeTest for the DOM built using the InputSource.- Throws:
SAXException
IOException
-
NodeTest
Construct a NodeTest for the specified Document- Throws:
IllegalArgumentException
- if the Document does not support the DOM DocumentTraversal interface (most DOM implementations should provide this support)
-
NodeTest
Construct a NodeTest using the specified DocumentTraversal, starting at the specified root node
-
-
Method Details
-
getDocumentTraversal
Try to cast a Document into a DocumentTraversal- Parameters:
document
-- Returns:
- DocumentTraversal interface if the DOM implementation supports it
-
performTest
Does this NodeTest pass using the specified NodeTester instance?- Parameters:
tester
-singleNodeType
- noteNode.ATTRIBUTE_NODE
is not exposed by the DocumentTraversal node iterator unless the root node is itself an attribute - so a NodeTester that needs to test attributes should obtain those attributes fromNode.ELEMENT_NODE
nodes- Throws:
NodeTestException
- if test fails
-
performTest
Does this NodeTest pass using the specified NodeTester instance?- Parameters:
tester
-nodeTypes
- noteNode.ATTRIBUTE_NODE
is not exposed by the DocumentTraversal node iterator unless the root node is itself an attribute - so a NodeTester that needs to test attributes should obtain those attributes fromNode.ELEMENT_NODE
nodes instead- Throws:
NodeTestException
- if test fails
-