tags:

views:

50

answers:

1

Hi,

I have the following xpath query which seems to be working but I just want to be sure its not incorrect:

//link[@type='application/rss+xml' or @type='application/atom+xml' and @rel='alternate']

The purpose is to do feed autodiscovery from a web page.

What I want it to do is:

all link tags with either (rss or atom) and rel alternate

but what I suspect it is doing is

all link tags with either (rss) or (atom and rel alternate)

Can anyone clarify if this is the case and also provide the correct query if I have made a mistake?

Thanks

+1  A: 

According to the spec, and has higher precedence than or. So, the latter would be the correct interpretation. You'll need to add parenthesis to group the @type expressions together.

Devon_C_Miller
Thank you. I know it was terribly lazy of me to lean on the community and I am not normally like this but I haven't got on well with the xpath in the past and I really needed to be sure. Thanks again!
rtpHarry