net.sf.saxon.pattern
Class NodeTest
java.lang.Object
|
+--net.sf.saxon.pattern.Pattern
|
+--net.sf.saxon.pattern.NodeTest
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- AnyChildNodePattern, AnyNodeTest, CombinedNodeTest, ContentTypeTest, LocalNameTest, NamespaceTest, NameTest, NodeKindTest, NoNodeTest
- public abstract class NodeTest
- extends Pattern
A NodeTest is a simple kind of pattern that enables a context-free test of whether
a node has a particular
name. There are several kinds of node test: a full name test, a prefix test, and an
"any node of a given type" test, an "any node of any type" test, a "no nodes"
test (used, e.g. for "@comment()")
- See Also:
- Serialized Form
Method Summary |
abstract boolean |
allowsTextNodes()
Indicate whether this NodeTest is capable of matching text nodes |
NodeTest |
getNodeTest()
Get a NodeTest that all the nodes matching this pattern must satisfy |
abstract boolean |
matches(int nodeKind,
int fingerprint,
int annotation)
Test whether this node test is satisfied by a given node. |
boolean |
matches(NodeInfo node,
Controller controller)
Determine whether this Pattern matches the given Node. |
Methods inherited from class net.sf.saxon.pattern.Pattern |
getDefaultPriority, getFingerprint, getItemType, getLineNumber, getSystemId, internalMatches, make, setLineNumber, setOriginalText, setSystemId, simplify, toString, typeCheck |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NodeTest
public NodeTest()
matches
public abstract boolean matches(int nodeKind,
int fingerprint,
int annotation)
- Test whether this node test is satisfied by a given node.
- Parameters:
nodeKind
- The kind of node to be matchedfingerprint
- identifies the expanded name of the node to be matched.
The value should be -1 for a node with no name.annotation
- The actual content type of the node
matches
public final boolean matches(NodeInfo node,
Controller controller)
- Determine whether this Pattern matches the given Node. This is the main external interface
for matching patterns: it sets current() to the node being tested
- Specified by:
matches
in class Pattern
- Parameters:
node
- The NodeInfo representing the Element or other node to be tested against the Patterncontroller
- The context in which the match is to take place. Only relevant if the pattern
uses variables, or contains calls on functions such as document() or key().
- Returns:
- true if the node matches the Pattern, false otherwise
getNodeTest
public NodeTest getNodeTest()
- Get a NodeTest that all the nodes matching this pattern must satisfy
- Specified by:
getNodeTest
in class Pattern
allowsTextNodes
public abstract boolean allowsTextNodes()
- Indicate whether this NodeTest is capable of matching text nodes