Querying with XPath
Document response;
// Initialize response object by parsing request...
String query = "/methodResponse/params/param/value/double";
if (impl.hasFeature("XPath", "3.0")) {
XPathEvaluator evaluator = (XPathEvaluator) response;
try {
XPathResult index = evaluator.evaluate(query, response,
null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null)
// work with the result...
}
catch (XPathException ex) {
System.err.println(query
+ " is not a correct XPath expression");
}
catch (DOMException ex) {
System.err.println(ex);
}
}