XPath Predicates
-
Hi guys Is it possible in xpath to select all elements that start with a value? For example, say I have this XML:- Nokia N73 Nokia N95 And I want to select all device elements whose name starts with "Nokia". Is there something like this in XPath: "/devices/device[name like 'Nokia*']" Thanks in advance
-
Hi guys Is it possible in xpath to select all elements that start with a value? For example, say I have this XML:- Nokia N73 Nokia N95 And I want to select all device elements whose name starts with "Nokia". Is there something like this in XPath: "/devices/device[name like 'Nokia*']" Thanks in advance
-
Sorry, the XML didn't show properly. See below for example XML:
<devices>
<device>
<name>Nokia N73</name>
</device>
<device>
<name>Nokia N95</name>
</device>
</devices> -
Don't worry guys, I've found the solution:- XPath: "/devices/device[starts-with(., 'Nokia')]"