net.sf.saxon.pattern
Class KeyPattern
java.lang.Object
net.sf.saxon.pattern.Pattern
net.sf.saxon.pattern.NodeSetPattern
net.sf.saxon.pattern.KeyPattern
- All Implemented Interfaces:
- Serializable, SourceLocator, Container, PatternFinder
public final class KeyPattern
- extends NodeSetPattern
A KeyPattern is a pattern of the form key(keyname, keyvalue)
- See Also:
- Serialized Form
Methods inherited from class net.sf.saxon.pattern.Pattern |
getColumnNumber, getContainerGranularity, getDefaultPriority, getExecutable, getFingerprint, getHostLanguage, getLineNumber, getLocationProvider, getPublicId, getSystemId, internalMatches, make, makeSearchExpression, matchesBeneathAnchor, resolveCurrent, selectNodes, setExecutable, setLineNumber, setOriginalText, setSystemId, simplify, toString |
KeyPattern
public KeyPattern(StructuredQName keyName,
Expression key,
Configuration config)
- Constructor
- Parameters:
keyName
- the name of the keykey
- the value of the key: either a StringValue or a VariableReference
analyze
public Pattern analyze(ExpressionVisitor visitor,
ItemType contextItemType)
throws XPathException
- Type-check the pattern. This is needed for patterns that contain
variable references or function calls.
- Overrides:
analyze
in class NodeSetPattern
- Parameters:
visitor
- the expression visitorcontextItemType
- the type of the context item at the point where the pattern
is defined. Set to null if it is known that the context item is undefined.
- Returns:
- the optimised Pattern
- Throws:
XPathException
matches
public boolean matches(NodeInfo e,
XPathContext context)
throws XPathException
- Determine whether this Pattern matches the given Node.
- Overrides:
matches
in class NodeSetPattern
- Parameters:
e
- The NodeInfo representing the Element or other node to be tested against the Patterncontext
- The dynamic context. 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
- Throws:
XPathException
getNodeTest
public NodeTest getNodeTest()
- Get a NodeTest that all the nodes matching this pattern must satisfy
- Overrides:
getNodeTest
in class NodeSetPattern
- Returns:
- a NodeTest, as specific as possible, which all the matching nodes satisfy
Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.