net.sf.doolin.util.xml
Class XPathUtils

java.lang.Object
  extended by net.sf.doolin.util.xml.XPathUtils

public class XPathUtils
extends Object

XPath utility class. It caches the XPath context so the XPath requests can be more efficient.

Author:
Damien Coraboeuf

Constructor Summary
XPathUtils()
          Constructor.
 
Method Summary
 boolean evaluateBoolean(Node root, String path)
          Evaluates a boolean from an XPath expression.
 String evaluateString(Node root, String path)
          Evaluates a string from an XPath expression.
 NodeList selectNodeList(Node root, String path)
          Get a list of node using an XPath expression from a root node.
 Node selectSingleNode(Node root, String path)
          Get a single node using an XPath expression from a root node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathUtils

public XPathUtils()
Constructor.

Method Detail

evaluateBoolean

public boolean evaluateBoolean(Node root,
                               String path)
Evaluates a boolean from an XPath expression.

Parameters:
root - Root node where to evaluate the XPath from.
path - XPath expression.
Returns:
Result of the expression.

evaluateString

public String evaluateString(Node root,
                             String path)
Evaluates a string from an XPath expression.

Parameters:
root - Root node where to evaluate the XPath from.
path - XPath expression.
Returns:
Result of the expression.

selectNodeList

public NodeList selectNodeList(Node root,
                               String path)
Get a list of node using an XPath expression from a root node.

Parameters:
root - Root node where to evaluate the XPath from.
path - XPath expression.
Returns:
List of nodes

selectSingleNode

public Node selectSingleNode(Node root,
                             String path)
Get a single node using an XPath expression from a root node.

Parameters:
root - Root node where to evaluate the XPath from.
path - XPath expression.
Returns:
List of nodes


Copyright © 2011. All Rights Reserved.