开发者

how to pass a variable to an XPathExpression

i want to pass the value of a variable in XPathExpression. I want to put the id value in a variable. How开发者_开发百科 can I do that? Below is the code;

XPathExpression expr = xpath.compile("//Number[@id=1]/Movies/text()");

Above, I want to put the value of id in a variable. I tried int num =1 but doesn't works. Thanks.


String yourArg= "1";
XPathExpression expr = xpath.compile("//Number[@id="+yourArg+"]/Movies/text()");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜