it.svario.xpathapi.jaxp
public class XPathAPI extends Object
See the XPathAPI package documentation for an overview of XPathAPI and examples of how to use these methods.
it.svario.xpathapi.jaxp| Constructor and Description |
|---|
XPathAPI() |
| Modifier and Type | Method and Description |
|---|---|
static List<Node> |
selectListOfNodes(Node contextNode,
String xpathString,
Map<String,String> namespaces,
String... args)
Selects all the nodes that match the given XPath expression, taking
into account the namespace mappings defined in
namespaces
(returns a List<Node> list). |
static List<Node> |
selectListOfNodes(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Selects all the nodes that match the given XPath expression, taking
into account all namespaces found in
namespaceNode (returns a
List<Node> list). |
static List<Node> |
selectListOfNodes(Node contextNode,
String xpathString,
String... args)
Selects all the nodes that match the given XPath expression (returns a
List<Node> list). |
static org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Returns an iterator over all the nodes that match the given XPath
expression, taking into account all namespaces found in
namespaceNode. |
static org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(Node contextNode,
String xpathString,
String... args)
Returns an iterator over all the nodes that match the given XPath
expression.
|
static NodeList |
selectNodeList(Node contextNode,
String xpathString,
Map<String,String> namespaces,
String... args)
Selects all the nodes that match the given XPath expression, taking
into account the namespace mappings defined in
namespaces
(returns a org.w3c.dom.NodeList list). |
static NodeList |
selectNodeList(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Selects all the nodes that match the given XPath expression, taking
into account all namespaces found in
namespaceNode (returns a
org.w3c.dom.NodeList list). |
static NodeList |
selectNodeList(Node contextNode,
String xpathString,
String... args)
Selects all the nodes that match the given XPath expression (returns a
org.w3c.dom.NodeList list). |
static List<String> |
selectNodeListAsStrings(Node contextNode,
String xpathString,
Map<String,String> namespaces,
String... args)
Returns a list with the textual content of all the nodes that match the
given XPath expression, taking into account the namespace mappings
defined in
namespaces. |
static List<String> |
selectNodeListAsStrings(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Returns a list with the textual content of all the nodes that match the
given XPath expression, taking into account all namespaces found
namespaceNode. |
static List<String> |
selectNodeListAsStrings(Node contextNode,
String xpathString,
String... args)
Returns a list with the textual content of all the nodes that match the
given XPath expression.
|
static Node |
selectSingleNode(Node contextNode,
String xpathString,
Map<String,String> namespaces,
String... args)
Selects the first node that matches the given XPath expression, taking
additional namespace from the
namespaces mapping. |
static Node |
selectSingleNode(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Selects the first node that matches the given XPath expression, taking
into account all namespaces found in
namespaceNode. |
static Node |
selectSingleNode(Node contextNode,
String xpathString,
String... args)
Selects the first node that matches the given XPath expression.
|
static String |
selectSingleNodeAsString(Node contextNode,
String xpathString,
Map<String,String> namespaces,
String... args)
Returns the textual content of the first node that matches the given
XPath expression, taking into account the namespace mappings defined in
namespaces. |
static String |
selectSingleNodeAsString(Node contextNode,
String xpathString,
Node namespaceNode,
String... args)
Returns the textual content of the first node that matches the given
XPath expression, taking into account all namespaces found
namespaceNode. |
static String |
selectSingleNodeAsString(Node contextNode,
String xpathString,
String... args)
Returns the textual content of the first node that matches the given
XPath expression.
|
public static Node selectSingleNode(Node contextNode, String xpathString, String... args) throws XPathException
Any "{}" place-holder in the XPath expression is replaced with
the content of the respective replacement string supplied in
args. Please note that no escaping is performed on the
replacement strings, beware of single and double quotes.
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use selectSingleNode(Node, String, Map, String...)
or selectSingleNode(Node, String, Node, String...).
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static Node selectSingleNode(Node contextNode, String xpathString, Map<String,String> namespaces, String... args) throws XPathException
namespaces mapping.
This function behaves like
selectSingleNode(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not only those
available in contextNode, but also the ones defined in the
namespaces mapping.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaces - a mapping between namespace prefixes and URIsargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static Node selectSingleNode(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode.
This function behaves like
selectSingleNode(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not those
available in contextNode, but those available in
namespaceNode.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static String selectSingleNodeAsString(Node contextNode, String xpathString, String... args) throws XPathException
Any "{}" place-holder in the XPath expression is replaced with
the content of the respective replacement string supplied in
args. Please note that no escaping is performed on the
replacement strings, beware of single and double quotes.
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use
selectSingleNodeAsString(Node, String, Map, String...) or
selectSingleNodeAsString(Node, String, Node, String...).
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectSingleNode(Node, String, String...)public static String selectSingleNodeAsString(Node contextNode, String xpathString, Map<String,String> namespaces, String... args) throws XPathException
namespaces.
Basically, this method is equivalent to
Node node = selectSingleNode(contextNode, xpathString, namespaces); return node.getTextContent();
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaces - a mapping between namespace prefixes and URIsargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectSingleNode(Node, String, Map, String...)public static String selectSingleNodeAsString(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode.
Basically, this method is equivalent to
Node node = selectSingleNode(contextNode, xpathString, namespaceNode); return node.getTextContent();
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectSingleNode(Node, String, Node, String...)public static NodeList selectNodeList(Node contextNode, String xpathString, String... args) throws XPathException
org.w3c.dom.NodeList list).
Any "{}" place-holder in the XPath expression is replaced with
the content of the respective replacement string supplied in
args. Please note that no escaping is performed on the
replacement strings, beware of single and double quotes.
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use selectNodeList(Node, String, Map, String...) or
selectNodeList(Node, String, Node, String...).
It is better to use the
selectListOfNodes(Node, String, String...) method because it
returns a List<Node> instead of a legacy
org.w3c.dom.NodeList.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectListOfNodes(Node, String, String...)public static NodeList selectNodeList(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode (returns a
org.w3c.dom.NodeList list).
This function behaves like
selectNodeList(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not those
available in contextNode, but those available in
namespaceNode.
It is better to use the
selectListOfNodes(Node, String, Node, String...) method
because it returns a List<Node> instead of a legacy
org.w3c.dom.NodeList.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectListOfNodes(Node, String, Node, String...)public static NodeList selectNodeList(Node contextNode, String xpathString, Map<String,String> namespaces, String... args) throws XPathException
namespaces
(returns a org.w3c.dom.NodeList list).
This function behaves like
selectNodeList(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not only those
available in contextNode, but also the ones defined in the
namespaces mapping.
It is better to use the
selectListOfNodes(Node, String, Map, String...) method because
it returns a List<Node> instead of a legacy
org.w3c.dom.NodeList.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaces - a mapping between namespace prefixes and URIsargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectListOfNodes(Node, String, Map, String...)public static List<Node> selectListOfNodes(Node contextNode, String xpathString, String... args) throws XPathException
List<Node> list).
Any "{}" place-holder in the XPath expression is replaced with
the content of the respective replacement string supplied in
args. Please note that no escaping is performed on the
replacement strings, beware of single and double quotes.
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use selectListOfNodes(Node, String, Map, String...)
or selectListOfNodes(Node, String, Node, String...).
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static List<Node> selectListOfNodes(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode (returns a
List<Node> list).
This function behaves like
selectListOfNodes(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not those
available in contextNode, but those available in
namespaceNode.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static List<Node> selectListOfNodes(Node contextNode, String xpathString, Map<String,String> namespaces, String... args) throws XPathException
namespaces
(returns a List<Node> list).
This function behaves like
selectListOfNodes(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not only those
available in contextNode, but also the ones defined in the
namespaces mapping.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaces - a mapping between namespace prefixes and URIsargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionpublic static List<String> selectNodeListAsStrings(Node contextNode, String xpathString, String... args) throws XPathException
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use
selectNodeListAsStrings(Node, String, Map, String...) or
selectNodeListAsStrings(Node, String, Node, String...).
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectNodeList(Node, String, String...)public static List<String> selectNodeListAsStrings(Node contextNode, String xpathString, Map<String,String> namespaces, String... args) throws XPathException
namespaces.
This function behaves like
selectNodeListAsStrings(Node, String, String...), but the
namespace prefixes that can be used in the XPath expression are not
only those available in contextNode, but also the ones defined
in the namespaces mapping.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaces - args - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectNodeList(Node, String, Map, String...)public static List<String> selectNodeListAsStrings(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode.
This function behaves like
selectNodeListAsStrings(Node, String, String...), but the
namespace prefixes that can be used in the XPath expression are not
those available in contextNode, but those available in
namespaceNode.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectNodeList(Node, String, Node, String...)public static org.w3c.dom.traversal.NodeIterator selectNodeIterator(Node contextNode, String xpathString, String... args) throws XPathException
Same as selectNodeList(Node, String, String...) but returns a
NodeIterator instead of a simple NodeList.
The only namespaces prefixes usable in the XPath expression are those
available in contextNode. If other additional prefixes are
required, use
selectNodeIterator(Node, String, Node, String...).
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluateargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectNodeList(Node, String, String...)public static org.w3c.dom.traversal.NodeIterator selectNodeIterator(Node contextNode, String xpathString, Node namespaceNode, String... args) throws XPathException
namespaceNode.
Same as selectNodeList(Node, String, Node, String...) but
returns a NodeIterator instead of a simple NodeList.
This function behaves like
selectNodeIterator(Node, String, String...), but the namespace
prefixes that can be used in the XPath expression are not those
available in contextNode, but those available in
namespaceNode.
contextNode - the node from which the XPath expression is
evaluatedxpathString - the XPath expression to evaluatenamespaceNode - the node from which all the namespace declarations
will be takenargs - an optional array of strings used to replace the
"{}" place-holders in xpathStringXPathExceptionselectNodeList(Node, String, Node, String...)Copyright © 2011-2013. All Rights Reserved.