com.caucho.xpath
Class Pattern

java.lang.Object
  |
  +--com.caucho.xpath.Pattern
Direct Known Subclasses:
UnionPattern

public abstract class Pattern
extends java.lang.Object

A node selection pattern. Patterns represent compiled XPath node selectors. They can be used to find nodes, select nodes, and test if a node matches a pattern.

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.


Field Summary
protected static WriteStream dbg
           
 
Method Summary
 Node find(Node context)
          Returns the first node matching the pattern.
 Node find(Node context, Env env)
          Returns the first node matching the pattern.
 java.lang.String getNodeName()
          Returns the name of the matching node or '*' if many nodes match.
protected  java.lang.String getPrefix()
           
 double getPriority()
          Returns the pattern's default priority as defined by the XSLT draft.
 boolean isMatch(Node node)
          Test if the node matches the pattern.
 boolean isMatch(Node node, Env env)
          Test if the node matches the pattern.
 java.util.Iterator select(Node context)
          Selects all nodes matching the pattern.
 java.util.Iterator select(Node node, Env env)
          Selects all nodes matching the pattern.
 java.lang.String toPatternString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbg

protected static WriteStream dbg
Method Detail

find

public Node find(Node context)
Returns the first node matching the pattern. The pattern should be a select pattern.
Parameters:
context - node represented by '.' and start of match.
Returns:
first matching node

find

public Node find(Node context,
                 Env env)
Returns the first node matching the pattern. The pattern should be a select pattern.
Parameters:
context - node represented by '.' and start of match.
env - variable environment.
Returns:
first matching node

select

public java.util.Iterator select(Node context)
Selects all nodes matching the pattern. The pattern should be a select pattern.
Parameters:
context - node represented by '.' and start of match.
Returns:
iterator of matching nodes

select

public java.util.Iterator select(Node node,
                                 Env env)
Selects all nodes matching the pattern. The pattern should be a select pattern.
Parameters:
context - node represented by '.' and start of match.
env - variable environment.
Returns:
iterator of matching nodes

isMatch

public boolean isMatch(Node node)
Test if the node matches the pattern. The pattern should be a match pattern.
Parameters:
node - node to test
Returns:
true if the pattern matches.

isMatch

public boolean isMatch(Node node,
                       Env env)
Test if the node matches the pattern. The pattern should be a match pattern.
Parameters:
node - node to test
env - variable environment.
Returns:
true if the pattern matches.

getPriority

public double getPriority()
Returns the pattern's default priority as defined by the XSLT draft.

getNodeName

public java.lang.String getNodeName()
Returns the name of the matching node or '*' if many nodes match.

The Xsl package uses this to speed template matching.


getPrefix

protected java.lang.String getPrefix()

toPatternString

public java.lang.String toPatternString()