tags:

views:

18

answers:

1
+1  Q: 

XPath Find items

How can I return all the 'make' items from the xml document using an xpath query

<vehicles>
<car>
    <make>Benz</make>
    <make>Nissan</make>
</car>
<motorbike>
    <make>Honda</make>
</motorbike>

+3  A: 

I would use /*/*/make. (You could use //make, but I try to avoid // for efficiency reasons.)

The w3schools has a good tutorial on XPath: http://www.w3schools.com/xpath/default.asp

Also, you should add </vehicles> to your XML to make it well formed.

DevNull
Oops... forgot to add the ending tag.. .Cheers
Henno
+1 For avoid `//` operator recommendation.
Alejandro