org.merlotxml.util.xml
Class XPathUtil

java.lang.Object
  |
  +--org.merlotxml.util.xml.XPathUtil

public class XPathUtil
extends java.lang.Object

General XPath utilities

Version:
$Id: XPathUtil.java,v 1.2 2000/05/19 20:34:25 timm Exp $
Author:
Tim McCune (with thanks to Scott Boag for providing the initial example)

Constructor Summary
XPathUtil()
           
 
Method Summary
static java.lang.String getValue(org.w3c.dom.Node contextNode, java.lang.String str)
           
static java.util.List getValueList(org.w3c.dom.Node contextNode, java.lang.String xpath)
           
static org.w3c.dom.NodeList selectNodes(org.w3c.dom.Node contextNode, java.lang.String str)
          Select a list of nodes using an XPath expression
static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode, java.lang.String str)
          Select a single node using an XPath expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathUtil

public XPathUtil()
Method Detail

selectNodes

public static org.w3c.dom.NodeList selectNodes(org.w3c.dom.Node contextNode,
                                               java.lang.String str)
                                        throws org.xml.sax.SAXException
Select a list of nodes using an XPath expression
Parameters:
contextNode - The node to start searching from.
str - A valid XPath string.
Returns:
The list of nodes that match the XPath, or null if none

selectSingleNode

public static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode,
                                                java.lang.String str)
                                         throws org.xml.sax.SAXException
Select a single node using an XPath expression
Parameters:
contextNode - The node to start searching from.
str - A valid XPath string.
Returns:
The first node found that matches the XPath, or null if none

getValue

public static java.lang.String getValue(org.w3c.dom.Node contextNode,
                                        java.lang.String str)
                                 throws org.xml.sax.SAXException

getValueList

public static java.util.List getValueList(org.w3c.dom.Node contextNode,
                                          java.lang.String xpath)
                                   throws org.xml.sax.SAXException