I would like to construct an xpath query such that xpathexpression.evaulate returns a list of values prefixed with an arbitrary string.
Achieving this with a single result is a simple concat('PREFIX:',/returns/one/node)
, although the valid xpath query /returns/many/nodes/concat('PREFIX:',text())
is not accepted by xpathexpression.evaulate.
Here is my function call:
NodeList resultNodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
String collectionIDs[] = new String[resultNodes.getLength()];
This is the error I receive:
javax.xml.transform.TransformerException: Unknown nodetype: concat
Does anyone know of an evaluate-friendly alternative?
Thank you in advance