Package net.sf.saxon.pattern
Class PatternWithPredicate
java.lang.Object
net.sf.saxon.pattern.Pattern
net.sf.saxon.pattern.PatternWithPredicate
- All Implemented Interfaces:
Serializable
,SourceLocator
,Container
,PatternFinder
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionanalyze
(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) Type-check the pattern.double
Determine the default priority to use if this pattern appears as a match pattern for a template with no explicit priority attribute.Get an ItemType that all the items matching this pattern must satisfyIterate over the subexpressions within this patternboolean
matches
(Item item, XPathContext context) Determine whether this Pattern matches the given Node.Methods inherited from class net.sf.saxon.pattern.Pattern
allocateSlots, getColumnNumber, getContainerGranularity, getDependencies, getExecutable, getFingerprint, getHostLanguage, getLineNumber, getLocationProvider, getNodeKind, getPublicId, getSystemId, internalMatches, make, matchesBeneathAnchor, promote, replaceSubExpression, resolveCurrent, selectNodes, setExecutable, setLineNumber, setOriginalText, setSystemId, setVariableBindingExpression, simplify, toString
-
Constructor Details
-
PatternWithPredicate
-
-
Method Details
-
matches
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 classPattern
- Parameters:
item
- 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
- if a dynamic error occurs during pattern matching
-
getItemType
Get an ItemType that all the items matching this pattern must satisfy- Specified by:
getItemType
in classPattern
- Returns:
- an ItemType, as specific as possible, which all the matching items satisfy
-
iterateSubExpressions
Iterate over the subexpressions within this pattern- Overrides:
iterateSubExpressions
in classPattern
- Returns:
- an iterator over the subexpressions. Default implementation returns an empty sequence
-
analyze
public Pattern analyze(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException Type-check the pattern.- Overrides:
analyze
in classPattern
- 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
- if a static error is discovered
-
getDefaultPriority
public double getDefaultPriority()Determine the default priority to use if this pattern appears as a match pattern for a template with no explicit priority attribute.- Overrides:
getDefaultPriority
in classPattern
- Returns:
- the default priority for the pattern
-