Author
XPath
Niall Loughnane
Ranch Hand
Joined: Dec 07, 2006
Posts: 201
posted May 14, 2009 12:06:09
0
Hi,
i have the following XML and trying to run an xPath query to get the xml 'entry' fields that have a 'name' field that contains text "liz" AND 'entry' fields that contain a 'link' field that have an attribute 'rel' with "linkrel"
<xml>
<feed>
<entry>
<name>
liz
</name>
<link rel="linkrel"/>
<entry>
<name>
barry
</name>
<link rel="linkrel"/>
</entry>
<entry>
<name>
gobbly
</name>
</entry>
</feed>
any ideas?
Cheers,
Niall
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
I don't see anything about testing in the question. So let's move it to the XML forum.
In general when your specs for the XPath include "which" or "such that" then you need a predicate in your XPath expression.
Niall Loughnane
Ranch Hand
Joined: Dec 07, 2006
Posts: 201
posted May 14, 2009 13:10:53
0
sound, just thought that it was a testing question, since its testing the XML schema,
like i know that there can be 2 XPath queries:
/feed/entry/link[@rel='linkrel']
and
/feed/entry[name = 'liz']
but how to combine them?
subject: XPath