Inco Mob
Inco Mob

Reputation: 594

Get the nodes containg an attribute with a certain value in XML in XPath

i want to find nodes containg an attribute with a certain value in XML . I tried with a certain Xpath expression but it wont work..

String expression = ".*[@*[starts-with(., '"+search+"')]]";

Here the search is the variable which contains the value which i want to search. Can anyone tell me the right Xpath expression.

Thanks.

Upvotes: 1

Views: 164

Answers (1)

Tomalak
Tomalak

Reputation: 338208

Your expression is correct, only the .* makes no sense.

String expression = "//*[@*[starts-with(., '"+search+"')]]";

Upvotes: 1

Related Questions