Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.neoworks.util
Class XPathQuery

    java.lang.Object
      |
      +--com.neoworks.util.XPathQuery

public class XPathQuery
extends java.lang.Object

This class wraps up DOM XPath queries so they're a bit easier to do.

The more observant amongst you may have noticed that this is a wrapper for a wrapper class. This is deliberate as XPathAPI is intended as a stopgap until the methods are rationalised and included in the Xalan API. This could mean an API change, meaning a second level of wrappers is required to ensure future compatibility with Xalan.

Version:
  $Revision: 1.2 $
Author:
  Nick Vincent nick@neoworks.com

Method Summary
`static org.w3c.dom.NodeList` | `getNodes(org.w3c.dom.Document doc, java.lang.String xpath)` Perform the given XPath query on the given document, returning a list of matching nodes
`static org.w3c.dom.NodeList` | `getNodes(org.w3c.dom.Node node, java.lang.String xpath)` Perform the given XPath query in the given document, returning a list of matching nodes.
`static org.w3c.dom.Node` | `getSingleNode(org.w3c.dom.Document doc, java.lang.String xpath)` Perform the given XPath query on the given document, returning a single matching node.
`static org.w3c.dom.Node` | `getSingleNode(org.w3c.dom.Node node, java.lang.String xpath)` Perform the given XPath query on the given DOM node, returning a single matching node.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getNodes

    public static org.w3c.dom.NodeList getNodes(org.w3c.dom.Node node,
                                                java.lang.String xpath)

  Perform the given XPath query in the given document, returning a list of matching nodes.

  Parameters:
    `node` - The node to query on
    `xpath` - the XPath query to run
  Returns:
    A list of nodes matching the XPath query

### getNodes

    public static org.w3c.dom.NodeList getNodes(org.w3c.dom.Document doc,
                                                java.lang.String xpath)

  Perform the given XPath query on the given document, returning a list of matching nodes

  Parameters:
    `doc` - The document to query on
    `xpath` - the XPath query to run
  Returns:
    A list of nodes matching the XPath query

### getSingleNode

    public static org.w3c.dom.Node getSingleNode(org.w3c.dom.Node node,
                                                 java.lang.String xpath)

  Perform the given XPath query on the given DOM node, returning a single matching node.

  Parameters:
    `node` - The node to query on
    `xpath` - the XPath query to run
  Returns:
    The first matching node, otherwise null

### getSingleNode

    public static org.w3c.dom.Node getSingleNode(org.w3c.dom.Document doc,
                                                 java.lang.String xpath)

  Perform the given XPath query on the given document, returning a single matching node.

  Parameters:
    `doc` - The document to query on
    `xpath` - the XPath query to run
  Returns:
    A matching node, otherwise null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD