org.planx.xpath
Class XPath

java.lang.Object
  extended by org.planx.xpath.XPath

public class XPath
extends Object

Represents an XPath expression. See package description for information about what is supported and what is not, as well as a brief overview of the design.

A simple usage example:

     Navigator nav = new XMLStoreNavigator();
     DocNode node = new DocNode(...get node from XML Store...);
     XPath xpath = new XPath("child::node()", nav);
     XObject result = xpath.evaluate(node);
 


Constructor Summary
XPath(String expr, Navigator nav)
          Construct a new XPath from the given string expression and set it to use the specified navigator.
 
Method Summary
 XObject evaluate(Context ctxt, Environment env)
          Evaluate this XPath expression using the specified context and environment.
 XObject evaluate(Object ctxtNode)
          Evaluate this XPath expression using the specified context node.
 XObject evaluate(Object ctxtNode, Environment env)
          Evaluate this XPath expression using the specified context node and environment.
 String toString()
          Returns the expression as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XPath

public XPath(String expr,
             Navigator nav)
      throws XPathException
Construct a new XPath from the given string expression and set it to use the specified navigator.

Throws:
XPathException
Method Detail

evaluate

public XObject evaluate(Context ctxt,
                        Environment env)
                 throws XPathException
Evaluate this XPath expression using the specified context and environment.

Throws:
XPathException

evaluate

public XObject evaluate(Object ctxtNode,
                        Environment env)
                 throws XPathException
Evaluate this XPath expression using the specified context node and environment.

Throws:
XPathException

evaluate

public XObject evaluate(Object ctxtNode)
                 throws XPathException
Evaluate this XPath expression using the specified context node. The environment will be initialized to default values (i.e. using core library functions only and no variables bound).

Throws:
XPathException

toString

public String toString()
Returns the expression as a string. The string returned is not the original string used to construct the expression, but rather a representation of the expression after parsing. Useful for debugging purposes.

Overrides:
toString in class Object


Copyright © 2010. All Rights Reserved.