# Class zXPath

- `Object`

- `zXPath`

## Description

The `zXPath` class is used to perform cross-browser XPath evaluations on DOM documents.

This class equalizes the differences between Internet Explorer and Mozilla implementations (other browsers don't support JavaScript-based XPath).

#### Author:

Nicholas C. Zakas, http://www.nczonline.net/

#### Version:

1.0

#### Since:

1.0

## Method Summary

`static Array` | `selectNodes(Node oRefNode, String sXPath)` Returns all nodes matching the XPath expression.
`static Array` | `selectNodes(Node oRefNode, String sXPath, Object oXmlNs)` Returns all nodes matching the XPath expression.
`static Node` | `selectSingleNode(Node oRefNode, String sXPath)` Gets the first node matching the XPath expression.
`static Node` | `selectSingleNode(Node oRefNode, String sXPath, Object oXmlNs)` Gets the first node matching the XPath expression.

## Method Detail

### selectNodes

`public static Array selectNodes(Node oRefNode, String sXPath)`

Returns all nodes matching the XPath expression.

#### Arguments:

- `oRefNode` - The reference node for the XPath evaluation.
- `sXPath` - The XPath expression to run.

#### Returns:

An array containing all nodes that match the XPath expression (an empty array if no matches are found).

### selectNodes

`public static Array selectNodes(Node oRefNode, String sXPath, Object oXmlNs)`

Returns all nodes matching the XPath expression.

#### Arguments:

- `oRefNode` - The reference node for the XPath evaluation.
- `sXPath` - The XPath expression to run.
- `oXmlNs` - The XML namespaces used in the XPath expression.

#### Returns:

An array containing all nodes that match the XPath expression (an empty array if no matches are found).

### selectSingleNode

`public static Node selectNodes(Node oRefNode, String sXPath)`

Returns the first node matching the XPath expression.

#### Arguments:

- `oRefNode` - The reference node for the XPath evaluation.
- `sXPath` - The XPath expression to run.

#### Returns:

The first node matching the XPath expression.

### selectSingleNode

`public static Node selectSingleNode(Node oRefNode, String sXPath, Object oXmlNs)`

Returns the first node matching the XPath expression.

#### Arguments:

- `oRefNode` - The reference node for the XPath evaluation.
- `sXPath` - The XPath expression to run.
- `oXmlNs` - The XML namespaces used in the XPath expression.

#### Returns:

The first node matching the XPath expression.