I am upgrading from XPath 1.0 to XPath 3.1. I used the library javax.xml.xpath
for XPath 1.0 and am now using the Saxon-HE
library. It was fairly straightforward to migrate the code and I used the S9API interface for the evaluation of the expressions as suggested by saxon.
There is however one little part of code that I can not seem to figure out how to migrate:
public static Object getXpathValueFromContentMap(String name, Map<String, Object> content, boolean list) {
try {
if (list) {
return newArrayList(JXPathContext.newContext(content).iterate(name));
} else {
return JXPathContext.newContext(content).getValue(name);
}
} catch (JXPathNotFoundException ignore) {
return null;
}
}
This method evalutes an xpath expression on a map. Can this be done using the saxon library and if so, how?