public abstract class XPathUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DYNAMIC_NS_END |
static String |
DYNAMIC_NS_START
Dynamic namespace prefix suffix
|
Modifier and Type | Method and Description |
---|---|
static Object |
evaluate(Node node,
String xPathExpression,
NamespaceContext nsContext,
XPathExpressionResult resultType)
Evaluate XPath expression as String result type regardless
what actual result type the expression will evaluate to.
|
static Boolean |
evaluateAsBoolean(Node node,
String xPathExpression,
NamespaceContext nsContext)
Evaluate XPath expression with result type Boolean value.
|
static Node |
evaluateAsNode(Node node,
String xPathExpression,
NamespaceContext nsContext)
Evaluate XPath expression with result type Node.
|
static NodeList |
evaluateAsNodeList(Node node,
String xPathExpression,
NamespaceContext nsContext)
Evaluate XPath expression with result type NodeList.
|
static Double |
evaluateAsNumber(Node node,
String xPathExpression,
NamespaceContext nsContext)
Evaluate XPath expression with result type Number.
|
static Object |
evaluateAsObject(Node node,
String xPathExpression,
NamespaceContext nsContext,
QName resultType)
Evaluate XPath expression.
|
static String |
evaluateAsString(Node node,
String xPathExpression,
NamespaceContext nsContext)
Evaluate XPath expression with result type String.
|
static Object |
evaluateExpression(Node node,
String xPathExpression,
NamespaceContext nsContext,
QName returnType)
Evaluates the expression.
|
static Map<String,String> |
getDynamicNamespaces(String expression)
Extracts dynamic namespaces that are inline inside a XPath expression.
|
static boolean |
hasDynamicNamespaces(String expression)
Searches for dynamic namespaces in expression.
|
static boolean |
isXPathExpression(String expression)
Method to find out whether an expression is of XPath nature or custom dot notation syntax.
|
static String |
replaceDynamicNamespaces(String expression,
Map<String,String> namespaces)
Replaces all dynamic namespaces in a XPath expression with respective prefixes
in namespace map.
|
public static final String DYNAMIC_NS_START
public static final String DYNAMIC_NS_END
public static Map<String,String> getDynamicNamespaces(String expression)
/{http://sample.org/foo}foo/{http://sample.org/bar}bar
expression
- public static String replaceDynamicNamespaces(String expression, Map<String,String> namespaces)
/{http://sample.org/foo}foo/{http://sample.org/bar}bar
results in /ns1:foo/ns2:bar
where the namespace map contains ns1 and ns2.expression
- namespaces
- public static boolean hasDynamicNamespaces(String expression)
expression
- public static Object evaluate(Node node, String xPathExpression, NamespaceContext nsContext, XPathExpressionResult resultType)
node
- xPathExpression
- nsContext
- resultType
- public static Node evaluateAsNode(Node node, String xPathExpression, NamespaceContext nsContext)
node
- xPathExpression
- nsContext
- public static NodeList evaluateAsNodeList(Node node, String xPathExpression, NamespaceContext nsContext)
node
- xPathExpression
- nsContext
- public static String evaluateAsString(Node node, String xPathExpression, NamespaceContext nsContext)
node
- xPathExpression
- nsContext
- public static Boolean evaluateAsBoolean(Node node, String xPathExpression, NamespaceContext nsContext)
node
- xPathExpression
- nsContext
- public static Double evaluateAsNumber(Node node, String xPathExpression, NamespaceContext nsContext)
node
- xPathExpression
- nsContext
- public static Object evaluateAsObject(Node node, String xPathExpression, NamespaceContext nsContext, QName resultType)
node
- xPathExpression
- nsContext
- public static boolean isXPathExpression(String expression)
expression
- the expression string to check.public static Object evaluateExpression(Node node, String xPathExpression, NamespaceContext nsContext, QName returnType)
node
- the node.xPathExpression
- the expression.nsContext
- the context.returnType
- Copyright © 2008–2017 ConSol Software GmbH. All rights reserved.