tokenize in xpath using java code -


is there way tokenize value xpath.

trying did't help. string xpath="tokenize(/root/child, '~')[1]";

getattributevalue(element,xpath);

public static string getattributevalue(element obj, string xpath) throws exception{   xpathfactory xpathfactory = xpathfactory.newinstance(); xpath xpatha = xpathfactory.newxpath(); xpathexpression expr = xpatha.compile(xpath); string value =(string) expr.evaluate(obj, xpathconstants.string);   return value; 

}

<root> <child>hello~how~are~you</child></root> 

i need 'how' second token xpath. how can this

you need use xpath 2.0 or 3.0 or xquery 1.0 or later implementation (as tokenize introduced in 2007 in xpath 2.0 or xquery 1.0) , suitable api allows return values xpath 2.0 or xquery 1.0 deal with.

so instance using saxon 9.6 , xpath 2.0 suggest use http://saxonica.com/html/documentation/xpath-api/s9api-xpath.html.


Comments