Package org.eclipse.wst.xml.xpath.core.util

## org.eclipse.wst.xml.xpath.core.util
Class XSLTXPathHelper

    public class XSLTXPathHelper
    extends java.lang.Object

## Constructor Summary

`XSLTXPathHelper()`

## Method Summary

`public static java.lang.String` | `calculateXPathToNode(org.w3c.dom.Node node)` Returns a XPath expression given a DOM Node.
`public static void` | `compile(java.lang.String expression)`
`public static org.apache.xpath.objects.XObject` | `eval(org.w3c.dom.Node contextNode , java.lang.String str)` Evaluate XPath string to an XObject. Using this method, XPath namespace prefixes will be resolved from the namespaceNode.

`public static org.apache.xpath.objects.XObject`

`eval(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)`
Evaluate XPath string to an XObject. XPath namespace prefixes are resolved from the namespaceNode. The implementation of this is a little slow, since it creates a number of objects each time it is called. This could be optimized to keep the same objects around, but then thread-safety issues would arise.

`public static org.apache.xpath.objects.XObject`

`eval(org.w3c.dom.Node contextNode , java.lang.String str , org.apache.xml.utils.PrefixResolver prefixResolver)`
Evaluate XPath string to an XObject. XPath namespace prefixes are resolved from the namespaceNode. The implementation of this is a little slow, since it creates a number of objects each time it is called. This could be optimized to keep the same objects around, but then thread-safety issues would arise.

`protected static org.apache.xpath.compiler.FunctionTable` | `getFunctionTable()`
`public static org.w3c.dom.traversal.NodeIterator` | `selectNodeIterator(org.w3c.dom.Node contextNode , java.lang.String str)` Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the contextNode.
`public static org.w3c.dom.traversal.NodeIterator` | `selectNodeIterator(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)` Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the namespaceNode.
`public static org.w3c.dom.NodeList` | `selectNodeList(org.w3c.dom.Node contextNode , java.lang.String str)` Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the contextNode.
`public static org.w3c.dom.NodeList` | `selectNodeList(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)` Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the namespaceNode.
`public static org.w3c.dom.Node` | `selectSingleNode(org.w3c.dom.Node contextNode , java.lang.String str)` Use an XPath string to select a single node. XPath namespace prefixes are resolved from the context node, which may not be what you want (see the next method).
`public static org.w3c.dom.Node` | `selectSingleNode(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)` Use an XPath string to select a single node. XPath namespace prefixes are resolved from the namespaceNode.

## Constructor Detail

## XSLTXPathHelper

`public XSLTXPathHelper()`

## Methods Detail

## calculateXPathToNode

`public java.lang.String calculateXPathToNode(org.w3c.dom.Node node)`

Returns a XPath expression given a DOM Node.

### Parameters

`node` - The DOM Node to create the XPath expression.

### Returns

`java.lang.String`

## compile

`public void compile(java.lang.String expression)`

### Parameters

`expression`

### Throws:

`javax.xml.xpath.XPathExpressionException`

## eval

`public org.apache.xpath.objects.XObject eval(org.w3c.dom.Node contextNode , java.lang.String str)`

Evaluate XPath string to an XObject. Using this method, XPath namespace prefixes will be resolved from the namespaceNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

### Returns

`org.apache.xpath.objects.XObject` - An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## eval

`public org.apache.xpath.objects.XObject eval(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)`

Evaluate XPath string to an XObject. XPath namespace prefixes are resolved from the namespaceNode. The implementation of this is a little slow, since it creates a number of objects each time it is called. This could be optimized to keep the same objects around, but then thread-safety issues would arise.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

`namespaceNode` - The node from which prefixes in the XPath will be resolved to namespaces.

### Returns

`org.apache.xpath.objects.XObject` - An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## eval

`public org.apache.xpath.objects.XObject eval(org.w3c.dom.Node contextNode , java.lang.String str , org.apache.xml.utils.PrefixResolver prefixResolver)`

Evaluate XPath string to an XObject. XPath namespace prefixes are resolved from the namespaceNode. The implementation of this is a little slow, since it creates a number of objects each time it is called. This could be optimized to keep the same objects around, but then thread-safety issues would arise.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

`prefixResolver` - Will be called if the parser encounters namespace prefixes, to resolve the prefixes to URLs.

### Returns

`org.apache.xpath.objects.XObject` - An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## getFunctionTable

`protected org.apache.xpath.compiler.FunctionTable getFunctionTable()`

### Returns

`org.apache.xpath.compiler.FunctionTable`

## selectNodeIterator

`public org.w3c.dom.traversal.NodeIterator selectNodeIterator(org.w3c.dom.Node contextNode , java.lang.String str)`

Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the contextNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

### Returns

`org.w3c.dom.traversal.NodeIterator` - A NodeIterator, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## selectNodeIterator

`public org.w3c.dom.traversal.NodeIterator selectNodeIterator(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)`

Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the namespaceNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

`namespaceNode` - The node from which prefixes in the XPath will be resolved to namespaces.

### Returns

`org.w3c.dom.traversal.NodeIterator` - A NodeIterator, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## selectNodeList

`public org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode , java.lang.String str)`

Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the contextNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

### Returns

`org.w3c.dom.NodeList` - A NodeIterator, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## selectNodeList

`public org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)`

Use an XPath string to select a nodelist. XPath namespace prefixes are resolved from the namespaceNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

`namespaceNode` - The node from which prefixes in the XPath will be resolved to namespaces.

### Returns

`org.w3c.dom.NodeList` - A NodeIterator, should never be null.

### Throws:

`javax.xml.transform.TransformerException`

## selectSingleNode

`public org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode , java.lang.String str)`

Use an XPath string to select a single node. XPath namespace prefixes are resolved from the context node, which may not be what you want (see the next method).

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

### Returns

`org.w3c.dom.Node` - The first node found that matches the XPath, or null.

### Throws:

`javax.xml.transform.TransformerException`

## selectSingleNode

`public org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode , java.lang.String str , org.w3c.dom.Node namespaceNode)`

Use an XPath string to select a single node. XPath namespace prefixes are resolved from the namespaceNode.

### Parameters

`contextNode` - The node to start searching from.

`str` - A valid XPath string.

`namespaceNode` - The node from which prefixes in the XPath will be resolved to namespaces.

### Returns

`org.w3c.dom.Node` - The first node found that matches the XPath, or null.

### Throws:

`javax.xml.transform.TransformerException`