com.novell.xml.xpath
Class RelativeLocationPath

java.lang.Object
  extended bycom.novell.xml.xpath.NodeSetExpr
      extended bycom.novell.xml.xpath.RelativeLocationPath
All Implemented Interfaces:
Expression

public class RelativeLocationPath
extends NodeSetExpr
implements Expression

Class representing an XPath RelativeLocationPath. A RelativeLocationPath is composed of a series of Steps that are composed left-to-right. The result of a LocationPath is a node-set

See Also:
AbsoluteLocationPath, Step

Constructor Summary
RelativeLocationPath(RelativeLocationPath lhs, RelativeLocationPath rhs)
           
RelativeLocationPath(Step step)
          Construct a RelativeLocationPath with a single step
RelativeLocationPath(Step[] steps)
          Construct a RelativeLocationPath with multiple steps.
 
Method Summary
protected  void evalStep(NodeSet result, int index, Node contextNode, ExpressionContext context)
          Recursively evaluate a step relative to a context.
 ExpressionValue evaluate(Node contextNode, ExpressionContext context)
          Evaluate this RelativeLocationPath with respect to a context node and expression context.
 String toString()
          Provide a readable description for debugging.
 
Methods inherited from class com.novell.xml.xpath.NodeSetExpr
dump, getResultType, isConstant, registerForReset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.novell.xml.xpath.Expression
dump, getResultType, isConstant, registerForReset
 

Constructor Detail

RelativeLocationPath

public RelativeLocationPath(Step step)
Construct a RelativeLocationPath with a single step

Parameters:
step - The step in the location path

RelativeLocationPath

public RelativeLocationPath(Step[] steps)
Construct a RelativeLocationPath with multiple steps. The zeroeth element in the passed array is the left-most step in the path.

Parameters:
steps - Array of steps that compose the path

RelativeLocationPath

public RelativeLocationPath(RelativeLocationPath lhs,
                            RelativeLocationPath rhs)
Method Detail

toString

public String toString()
Provide a readable description for debugging.

Returns:
String representation

evaluate

public ExpressionValue evaluate(Node contextNode,
                                ExpressionContext context)
                         throws XPathEvaluationException
Evaluate this RelativeLocationPath with respect to a context node and expression context. The result is always a NodeSet

Specified by:
evaluate in interface Expression
Parameters:
contextNode - The context node
context - The expression context
Returns:
The resulting NodeSet (may be empty, will never be null)
Throws:
XPathEvaluationException

evalStep

protected void evalStep(NodeSet result,
                        int index,
                        Node contextNode,
                        ExpressionContext context)
                 throws XPathEvaluationException
Recursively evaluate a step relative to a context.

Parameters:
result - The NodeSet to contain result nodes
index - The current index into the steps array
contextNode - The context node for this step
context - The expression context for this step
Throws:
XPathEvaluationException