Class XPathUtils
java.lang.Object
org.openjump.util.XPathUtils
XPathUtils- Version:
- $Revision$, $Date$
- Author:
- Andreas Schmitz, last edited by: $Author$
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetDouble(String xpath, Element e, NamespaceContext nscontext) static ElementgetElement(String xpath, Element e, NamespaceContext nscontext) static LinkedList<Element> getElements(String xpath, Element e, NamespaceContext nscontext) static intgetInt(String xpath, Element e, NamespaceContext nscontext) static NodegetNode(String xpath, Element e, NamespaceContext nscontext) static LinkedList<Node> getNodes(String xpath, Element e, NamespaceContext nscontext)
-
Constructor Details
-
XPathUtils
public XPathUtils()
-
-
Method Details
-
getInt
public static int getInt(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- an int, possibly parsed from a double value
- Throws:
XPathExpressionException- if an XPathException occurs
-
getDouble
public static double getDouble(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- a double, possibly converted from an integer value
- Throws:
XPathExpressionException- if an XPathException occurs
-
getNodes
public static LinkedList<Node> getNodes(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- a list of matching nodes, or an empty list if none match
- Throws:
XPathExpressionException- if an XPathException occurs
-
getElements
public static LinkedList<Element> getElements(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- a list of matching elements, or an empty list if none match
- Throws:
XPathExpressionException- if an XPathException occurs
-
getNode
public static Node getNode(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- a matching node, or null if none match
- Throws:
XPathExpressionException- if an XPathException occurs
-
getElement
public static Element getElement(String xpath, Element e, NamespaceContext nscontext) throws XPathExpressionException - Parameters:
xpath- an XPath stringe- an XML elementnscontext- namespace context of the element- Returns:
- a matching element, or null if none matches
- Throws:
XPathExpressionException- if an XPathException occurs
-