Page 1 of 1

xpath: implementing search

Posted: Mon Nov 14, 2005 7:00 pm
by zqzproject
hi, in my java code, i have the following string as asearch string so as to look up for some particular nodes in an xml file:


xpathselect="//contact[child::"+ keywords + "/child::text()='" + keywordsvalue + "'";


however that selects the element with EXACTLY THE SAME value of keywords, not a sensible mechanism. so i d like to know if there are any wildcards in xpath or any way that i can do that so that i can do something like:

xpathselect = ""//contact[child::name/child::text()='*myname*']""

whihc then returns any contact whose name CONTAINS THE string myname? i know there is a function 'contains' in xpath, but have experimented alot still cant get it work. any hints pls?

thanks alot!!

Posted: Mon Nov 14, 2005 7:23 pm
by zqzproject
sory, sorted! simply apply the string to a contains function will do!