org.custommonkey.xmlunit
Class NodeTest

java.lang.Object
  extended by org.custommonkey.xmlunit.NodeTest

public class NodeTest
extends java.lang.Object

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.
Examples and more at xmlunit. sourceforge.net

See Also:
NodeTester

Constructor Summary
NodeTest(org.w3c.dom.Document document)
          Construct a NodeTest for the specified Document
NodeTest(org.w3c.dom.traversal.DocumentTraversal documentTraversal, org.w3c.dom.Node rootNode)
          Construct a NodeTest using the specified DocumentTraversal, starting at the specified root node
NodeTest(org.xml.sax.InputSource src)
          Construct a NodeTest for the DOM built using the InputSource.
NodeTest(java.io.Reader reader)
          Construct a NodeTest for the DOM built using the Reader and JAXP
NodeTest(java.lang.String xmlString)
          Construct a NodeTest for the DOM built using the String and JAXP
 
Method Summary
 void 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?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeTest

public NodeTest(java.lang.String xmlString)
         throws org.xml.sax.SAXException,
                java.io.IOException
Construct a NodeTest for the DOM built using the String and JAXP

Throws:
org.xml.sax.SAXException
java.io.IOException

NodeTest

public NodeTest(java.io.Reader reader)
         throws org.xml.sax.SAXException,
                java.io.IOException
Construct a NodeTest for the DOM built using the Reader and JAXP

Throws:
org.xml.sax.SAXException
java.io.IOException

NodeTest

public NodeTest(org.xml.sax.InputSource src)
         throws org.xml.sax.SAXException,
                java.io.IOException
Construct a NodeTest for the DOM built using the InputSource.

Throws:
org.xml.sax.SAXException
java.io.IOException

NodeTest

public NodeTest(org.w3c.dom.Document document)
Construct a NodeTest for the specified Document

Throws:
java.lang.IllegalArgumentException - if the Document does not support the DOM DocumentTraversal interface (most DOM implementations should provide this support)

NodeTest

public NodeTest(org.w3c.dom.traversal.DocumentTraversal documentTraversal,
                org.w3c.dom.Node rootNode)
Construct a NodeTest using the specified DocumentTraversal, starting at the specified root node

Method Detail

performTest

public void performTest(NodeTester tester,
                        short singleNodeType)
                 throws NodeTestException
Does this NodeTest pass using the specified NodeTester instance?

Parameters:
tester -
singleNodeType - note Node.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 from Node.ELEMENT_NODE nodes
Throws:
NodeTestException - if test fails

performTest

public void performTest(NodeTester tester,
                        short[] nodeTypes)
                 throws NodeTestException
Does this NodeTest pass using the specified NodeTester instance?

Parameters:
tester -
nodeTypes - note Node.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 from Node.ELEMENT_NODE nodes instead
Throws:
NodeTestException - if test fails

XMLUnit is hosted by sourceforge.net