Reputation: 1316
I have the following xml file:
<foo class="class1">
<bar class="title">
<span> HELLO WORLD </span>
</bar>
<bar class="desc">
<span> I don't want this text </span>
</bar>
</foo>
I want to isolate HELLO WORLD
using the class
attributes.
An example of what I have tried (but is not correct) is:
//*[@class="class1"]/[@class="title"]
What is the correct way of doing this?
Upvotes: 1
Views: 37
Reputation: 8414
You are missing an asterisk and a span:
//*[@class="class1"]/*[@class="title"]/span
But this would probably suffice:
//*[@class="title"]/span
Upvotes: 2