|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--at.gv.egovernment.moa.util.XPathUtils
Utility methods to evaluate XPath expressions on DOM nodes.
Field Summary | |
static String |
ALL_NODES_XPATH
The XPath expression selecting all nodes under a given root (including the root node itself). |
Constructor Summary | |
XPathUtils()
|
Method Summary | |
static String |
getAttributeValue(org.w3c.dom.Element root,
String xpath,
String def)
Return the value of a DOM attribute whose location is given by an XPath expression. |
static String |
getElementValue(org.w3c.dom.Element root,
String xpath,
String def)
Return the value of a DOM element whose location is given by an XPath expression. |
static org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(org.w3c.dom.Node contextNode,
org.w3c.dom.Element namespaceElement,
String exp)
Return a NodeIterator over the nodes matching the XPath
expression. |
static org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(org.w3c.dom.Node contextNode,
Map namespaceMapping,
String exp)
Return a NodeIterator over the nodes matching the XPath
expression. |
static org.w3c.dom.traversal.NodeIterator |
selectNodeIterator(org.w3c.dom.Node contextNode,
String exp)
Return a NodeIterator over the nodes matching the XPath
expression.
|
static org.w3c.dom.NodeList |
selectNodeList(org.w3c.dom.Node contextNode,
org.w3c.dom.Element namespaceElement,
String exp)
Return a NodeList of all the nodes matching the XPath
expression. |
static org.w3c.dom.NodeList |
selectNodeList(org.w3c.dom.Node contextNode,
Map namespaceMapping,
String exp)
Return a NodeList of all the nodes matching the XPath
expression. |
static org.w3c.dom.NodeList |
selectNodeList(org.w3c.dom.Node contextNode,
String exp)
Return a NodeList of all the nodes matching the XPath
expression.
|
static org.w3c.dom.Node |
selectSingleNode(org.w3c.dom.Node contextNode,
org.w3c.dom.Element namespaceElement,
String exp)
Select the first node matching an XPath expression. |
static org.w3c.dom.Node |
selectSingleNode(org.w3c.dom.Node contextNode,
Map namespaceMapping,
String exp)
Select the first node matching an XPath expression. |
static org.w3c.dom.Node |
selectSingleNode(org.w3c.dom.Node contextNode,
String exp)
Select the first node matching an XPath expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String ALL_NODES_XPATH
Constructor Detail |
public XPathUtils()
Method Detail |
public static org.w3c.dom.traversal.NodeIterator selectNodeIterator(org.w3c.dom.Node contextNode, String exp) throws XPathException
NodeIterator
over the nodes matching the XPath
expression.
All namespace URIs and prefixes declared in the Constants
interface are used for resolving namespaces.contextNode
- The root node from which to evaluate the XPath
expression.exp
- The XPath expression to evaluate.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.traversal.NodeIterator selectNodeIterator(org.w3c.dom.Node contextNode, org.w3c.dom.Element namespaceElement, String exp) throws XPathException
NodeIterator
over the nodes matching the XPath
expression.contextNode
- The root node from which to evaluate the XPath
expression.namespaceElement
- An element from which to build the
namespace mapping for evaluating the XPath expressionexp
- The XPath expression to evaluate.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.traversal.NodeIterator selectNodeIterator(org.w3c.dom.Node contextNode, Map namespaceMapping, String exp) throws XPathException
NodeIterator
over the nodes matching the XPath
expression.contextNode
- The root node from which to evaluate the XPath
expression.namespaceMapping
- A namespace prefix to namespace URI mapping
(String
to String
) for evaluating the XPath
expression.exp
- The XPath expression to evaluate.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode, String exp) throws XPathException
NodeList
of all the nodes matching the XPath
expression.
All namespace URIs and prefixes declared in the Constants
interface are used for resolving namespaces.contextNode
- The root node from which to evaluate the XPath
expression.exp
- The XPath expression to evaluate.NodeList
containing the matching nodes.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode, org.w3c.dom.Element namespaceElement, String exp) throws XPathException
NodeList
of all the nodes matching the XPath
expression.contextNode
- The root node from which to evaluate the XPath
expression.namespaceElement
- An element from which to build the
namespace mapping for evaluating the XPath expressionexp
- The XPath expression to evaluate.NodeList
containing the matching nodes.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.NodeList selectNodeList(org.w3c.dom.Node contextNode, Map namespaceMapping, String exp) throws XPathException
NodeList
of all the nodes matching the XPath
expression.contextNode
- The root node from which to evaluate the XPath
expression.namespaceMapping
- A namespace prefix to namespace URI mapping
(String
to String
) for evaluating the XPath
expression.exp
- The XPath expression to evaluate.NodeList
containing the matching nodes.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode, String exp) throws XPathException
Constants
interface are used for resolving namespaces.contextNode
- The root node from which to evaluate the XPath
expression.exp
- The XPath expression to evaluate.null
, if no node matched.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode, org.w3c.dom.Element namespaceElement, String exp) throws XPathException
contextNode
- The root node from which to evaluate the XPath
expression.namespaceElement
- An element from which to build the
namespace mapping for evaluating the XPath expressionexp
- The XPath expression to evaluate.null
, if no node matched.XPathException
- An error occurred evaluating the XPath expression.public static org.w3c.dom.Node selectSingleNode(org.w3c.dom.Node contextNode, Map namespaceMapping, String exp) throws XPathException
contextNode
- The root node from which to evaluate the XPath
expression.namespaceMapping
- A namespace prefix to namespace URI mapping
(String
to String
) for evaluating the XPath
expression.exp
- The XPath expression to evaluate.null
, if no node matched.XPathException
- An error occurred evaluating the XPath expression.public static String getElementValue(org.w3c.dom.Element root, String xpath, String def)
root
- The root element from which to evaluate the XPath.xpath
- The XPath expression pointing to the element whose value
to return.def
- The default value to return, if no element can be found using
the given xpath
.xpath
. Otherwise, def
is returned.public static String getAttributeValue(org.w3c.dom.Element root, String xpath, String def)
root
- The root element from which to evaluate the XPath.xpath
- The XPath expression pointing to the attribute whose value to
return.def
- The default value to return, if no attribute can be found using
the given xpath
.xpath
. Otherwise, def
is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |