public class NodeTest
extends java.lang.Object
NodeFilter
to pass the DOM Nodes
to a NodeTester instance that performs the acual Node validation.NodeTester
Modifier and Type | Class and Description |
---|---|
private static class |
NodeTest.NodeTypeNodeFilter
Node type specific Node Filter: accepts Nodes of those types specified
in constructor, rejects all others
|
Modifier and Type | Field and Description |
---|---|
private org.w3c.dom.traversal.DocumentTraversal |
documentTraversal |
private org.w3c.dom.Node |
rootNode |
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
private static org.w3c.dom.traversal.DocumentTraversal |
getDocumentTraversal(org.w3c.dom.Document document)
Try to cast a Document into a DocumentTraversal
|
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?
|
private final org.w3c.dom.traversal.DocumentTraversal documentTraversal
private final org.w3c.dom.Node rootNode
public NodeTest(java.lang.String xmlString) throws org.xml.sax.SAXException, java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public NodeTest(java.io.Reader reader) throws org.xml.sax.SAXException, java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public NodeTest(org.xml.sax.InputSource src) throws org.xml.sax.SAXException, java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public NodeTest(org.w3c.dom.Document document)
java.lang.IllegalArgumentException
- if the Document does not support the DOM
DocumentTraversal interface (most DOM implementations should provide this
support)public NodeTest(org.w3c.dom.traversal.DocumentTraversal documentTraversal, org.w3c.dom.Node rootNode)
private static org.w3c.dom.traversal.DocumentTraversal getDocumentTraversal(org.w3c.dom.Document document)
document
- public void performTest(NodeTester tester, short singleNodeType) throws NodeTestException
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
nodesNodeTestException
- if test failspublic void performTest(NodeTester tester, short[] nodeTypes) throws NodeTestException
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 insteadNodeTestException
- if test fails