clark.xpath
Class MainXPath

java.lang.Object
  |
  +--clark.xpath.MainXPath

public class MainXPath
extends java.lang.Object

This is the main method of the XPath engine. It first calls the tree constructor to translate the string XPath expression to tree for easier evaluation. After that the execute method is called for the tree. All these methods here are static, so they can be accessed from outside the package separately.


Constructor Summary
MainXPath()
           
 
Method Summary
static boolean checkRoot(clark.xpath.GeneralNode tree)
          Checks if the root of the XPath tree starts with a root axis.
static clark.xpath.GeneralNode compile(java.lang.String expr)
          Converts a string XPath expression into tree.
static java.util.LinkedList execute(clark.xpath.GeneralNode tree, w3c.dom.Node context)
          Evaluates a XPath tree with a DOM tree.
static clark.xpath.AtomicObject executeCanonical(clark.xpath.GeneralNode tree, w3c.dom.Node context)
           
static java.util.LinkedList processXPath(java.lang.String expr, w3c.dom.Node context)
          First compiles the XPath string to tree and after that evaluates it.
static clark.xpath.AtomicObject processXPathCanonical(java.lang.String expr, w3c.dom.Node context)
           
static java.util.LinkedList toList(clark.xpath.AtomicObject obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainXPath

public MainXPath()
Method Detail

compile

public static clark.xpath.GeneralNode compile(java.lang.String expr)
                                       throws ParseException
Converts a string XPath expression into tree. The method is static in order to be accessed from outside.

Parameters:
expr - The XPath expression to be translated (parsed).
Returns:
The root of the constructed tree.
ParseException

execute

public static java.util.LinkedList execute(clark.xpath.GeneralNode tree,
                                           w3c.dom.Node context)
                                    throws ParseException
Evaluates a XPath tree with a DOM tree.

Parameters:
tree - The root of the XPath tree;
context - The root of the DOM tree (subtree)
Returns:
The result selected nodes.
ParseException

checkRoot

public static boolean checkRoot(clark.xpath.GeneralNode tree)
Checks if the root of the XPath tree starts with a root axis. Used for sorting.


processXPath

public static java.util.LinkedList processXPath(java.lang.String expr,
                                                w3c.dom.Node context)
                                         throws ParseException
First compiles the XPath string to tree and after that evaluates it.

Parameters:
expr - The string XPath expression to be compiled.
context - The root of the DOM tree on which the XPath should be evaluated.
Returns:
The result selected nodes.
ParseException

processXPathCanonical

public static clark.xpath.AtomicObject processXPathCanonical(java.lang.String expr,
                                                             w3c.dom.Node context)
                                                      throws ParseException
ParseException

executeCanonical

public static clark.xpath.AtomicObject executeCanonical(clark.xpath.GeneralNode tree,
                                                        w3c.dom.Node context)

toList

public static java.util.LinkedList toList(clark.xpath.AtomicObject obj)