Package org.eclipse.wst.xml.xpath.core.util
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 |
public XSLTXPathHelper()
Methods Detail |
public java.lang.String calculateXPathToNode(org.w3c.dom.Node node)
Returns a XPath expression given a DOM Node.
node
- The DOM Node to create the XPath expression.
java.lang.String
public void compile(java.lang.String expression)
expression
javax.xml.xpath.XPathExpressionException
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.
contextNode
- The node to start searching from.
str
- A valid XPath string.
org.apache.xpath.objects.XObject
- An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
javax.xml.transform.TransformerException
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.
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.
org.apache.xpath.objects.XObject
- An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
javax.xml.transform.TransformerException
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.
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.
org.apache.xpath.objects.XObject
- An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
javax.xml.transform.TransformerException
protected org.apache.xpath.compiler.FunctionTable getFunctionTable()
org.apache.xpath.compiler.FunctionTable
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.
contextNode
- The node to start searching from.
str
- A valid XPath string.
org.w3c.dom.traversal.NodeIterator
- A NodeIterator, should never be null.
javax.xml.transform.TransformerException
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.
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.
org.w3c.dom.traversal.NodeIterator
- A NodeIterator, should never be null.
javax.xml.transform.TransformerException
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.
contextNode
- The node to start searching from.
str
- A valid XPath string.
org.w3c.dom.NodeList
- A NodeIterator, should never be null.
javax.xml.transform.TransformerException
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.
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.
org.w3c.dom.NodeList
- A NodeIterator, should never be null.
javax.xml.transform.TransformerException
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).
contextNode
- The node to start searching from.
str
- A valid XPath string.
org.w3c.dom.Node
- The first node found that matches the XPath, or null.
javax.xml.transform.TransformerException
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.
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.
org.w3c.dom.Node
- The first node found that matches the XPath, or null.
javax.xml.transform.TransformerException