Package org.openjump.util
Class XPathUtils
- java.lang.Object
-
- org.openjump.util.XPathUtils
-
public class XPathUtils extends Object
XPathUtils- Version:
- $Revision$, $Date$
- Author:
- Andreas Schmitz, last edited by: $Author$
-
-
Constructor Summary
Constructors Constructor Description XPathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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)
-
-
-
Method Detail
-
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
-
-