List of utility methods to do XPath Evaluate
String | asString(String expression, Node node) Evaluates the specified XPath expression and returns the result as a string. return evaluateAsString(expression, node);
|
Node | asNode(String nodeName, Node node) as Node if (node == null) return null; return findXPathNode(node, nodeName); |
NodeList | asNodeList(String nodeName, Node node) as Node List if (node == null) return null; return findXPathNodeList(node, nodeName); |
Long | asLong(String expression, Node node) Evaluates the specified XPath expression and returns the result as a Long. String longString = evaluateAsString(expression, node);
return (isEmptyString(longString)) ? null : Long
.valueOf(longString);
|
Integer | asInteger(String expression, Node node) Evaluates the specified XPath expression and returns the result as an Integer. String intString = evaluateAsString(expression, node);
return (isEmptyString(intString)) ? null : Integer
.valueOf(intString);
|
Float | asFloat(String expression, Node node) Evaluates the specified XPath expression and returns the result as a Float. String floatString = evaluateAsString(expression, node);
return (isEmptyString(floatString)) ? null : Float
.valueOf(floatString);
|
Double | asDouble(String expression, Node node) Evaluates the specified XPath expression and returns the results as a Double. String doubleString = evaluateAsString(expression, node);
return (isEmptyString(doubleString)) ? null : Double
.valueOf(doubleString);
|
Date | asDate(String expression, Node node) Evaluates the specified XPath expression and returns the result as a Date. String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; try { return dateUtils.parseIso8601Date(dateString); } catch (ParseException e) { log.error( "Unable to parse date '" + dateString + "': " ... |
Byte | asByte(String expression, Node node) Evaluates the specified XPath expression and returns the result as a Byte. String byteString = evaluateAsString(expression, node);
return (isEmptyString(byteString)) ? null : Byte
.valueOf(byteString);
|
ByteBuffer | asByteBuffer(String expression, Node node) Evaluates the specified xpath expression, base64 decodes the data and returns the result as a ByteBuffer. String base64EncodedString = evaluateAsString(expression, node); if (isEmptyString(base64EncodedString)) return null; if (!isEmpty(node)) { try { byte[] base64EncodedBytes = base64EncodedString .getBytes("UTF-8"); byte[] decodedBytes = Base64 ... |