public abstract class AbstractPattern
extends java.lang.Object
There are two types of patterns: select patterns and match patterns.
Select patterns match a node relative to another node.
find
and select
use select patterns.
Match patterns match a node in isolation. isMatch
uses
match patterns.
Modifier and Type | Field and Description |
---|---|
protected AbstractPattern |
_child |
protected AbstractPattern |
_parent |
protected static java.util.logging.Logger |
log |
static java.lang.String |
XMLNS |
Modifier and Type | Method and Description |
---|---|
AbstractPattern |
copyAxis()
Returns the owning axis for the pattern.
|
AbstractPattern |
copyPosition()
Returns the position matching pattern.
|
int |
count(org.w3c.dom.Node node,
Env env,
AbstractPattern pattern)
Returns the number of nodes in its context for a match pattern.
|
NodeIterator |
createNodeIterator(org.w3c.dom.Node node,
ExprEnvironment env,
AbstractPattern pattern)
Creates a new node iterator.
|
org.w3c.dom.Node |
findAny(org.w3c.dom.Node node,
ExprEnvironment env)
Find any node matching the pattern.
|
org.w3c.dom.Node |
firstNode(org.w3c.dom.Node node,
ExprEnvironment env)
Returns the first node in the selection order.
|
java.lang.String |
getNodeName()
Returns the name of the matching node or '*' if many nodes match.
|
AbstractPattern |
getParent()
Returns the parent pattern.
|
protected java.lang.String |
getPrefix()
For string conversion, returns the string prefix corresponding to
the parents.
|
double |
getPriority()
Returns the pattern's default priority as defined by the XSLT draft.
|
boolean |
isAscending()
Return true if the iterator is in document-order.
|
boolean |
isStrictlyAscending()
Returns true if the pattern is strictly ascending.
|
boolean |
isUnique()
Returns true if the pattern's iterator returns unique nodes.
|
org.w3c.dom.Node |
lastNode(org.w3c.dom.Node node)
Returns the last node in the selection order.
|
abstract boolean |
match(org.w3c.dom.Node node,
ExprEnvironment env)
The core match function test if the pattern matches the node.
|
org.w3c.dom.Node |
nextNode(org.w3c.dom.Node node,
org.w3c.dom.Node last)
Returns the next node in the selection order.
|
int |
position(org.w3c.dom.Node node,
Env env,
AbstractPattern pattern)
Returns the position of the node in its context for a match pattern.
|
NodeIterator |
select(org.w3c.dom.Node node,
ExprEnvironment env)
Returns an iterator selecting nodes in document order.
|
NodeIterator |
selectUnique(org.w3c.dom.Node node,
ExprEnvironment env)
Returns an iterator selecting unique nodes.
|
java.lang.String |
toPatternString() |
protected static final java.util.logging.Logger log
public static final java.lang.String XMLNS
protected AbstractPattern _parent
protected AbstractPattern _child
public AbstractPattern getParent()
public double getPriority()
public java.lang.String getNodeName()
The Xsl package uses this to speed template matching.
public NodeIterator select(org.w3c.dom.Node node, ExprEnvironment env) throws XPathException
node
- the starting node.env
- the variable environment.XPathException
public NodeIterator selectUnique(org.w3c.dom.Node node, ExprEnvironment env) throws XPathException
node
- the starting node.env
- the variable environment.context
- the context node.XPathException
public org.w3c.dom.Node findAny(org.w3c.dom.Node node, ExprEnvironment env) throws XPathException
node
- the current nodeenv
- the xpath environmentXPathException
public boolean isStrictlyAscending()
public boolean isUnique()
public NodeIterator createNodeIterator(org.w3c.dom.Node node, ExprEnvironment env, AbstractPattern pattern) throws XPathException
node
- the starting nodeenv
- the variable environmentpattern
- the level patternXPathException
public org.w3c.dom.Node firstNode(org.w3c.dom.Node node, ExprEnvironment env) throws XPathException
node
- the current nodevariable
- environmentXPathException
public org.w3c.dom.Node lastNode(org.w3c.dom.Node node)
node
- the current nodepublic org.w3c.dom.Node nextNode(org.w3c.dom.Node node, org.w3c.dom.Node last) throws XPathException
node
- the current nodelast
- the last nodeXPathException
public abstract boolean match(org.w3c.dom.Node node, ExprEnvironment env) throws XPathException
node
- the node to testenv
- the variable environment.XPathException
public boolean isAscending()
public int position(org.w3c.dom.Node node, Env env, AbstractPattern pattern) throws XPathException
node
- the current nodeenv
- the variable environmentpattern
- the position patternXPathException
public int count(org.w3c.dom.Node node, Env env, AbstractPattern pattern) throws XPathException
node
- the current nodeenv
- the variable environmentpattern
- the position patternXPathException
public AbstractPattern copyAxis()
public AbstractPattern copyPosition()
protected java.lang.String getPrefix()
public java.lang.String toPatternString()