How to get values in similar but little bit different nodes with xpath in one query?
I want to create xpath query to get url from link1 and link 2 with requirement to not change the order in results.
First situation
<div id="id">
<span class="class">
<a href=http://whatever.url>link 1</a>
</span>
</div>
Second Situation
<div id="id">
<span clas开发者_运维百科s="class anotherclass">
<h5>
<a href=http://whatever.url>link 2</a>
</h5>
</span>
</div>
(...Above situation can happen more times on site in any order...)
The problem in my case is as i shown in code that nodes are similar but sometimes can have an extra parent element (in this example h5 tag) to link. One of my ideas was to get the same part of each node and than make something like this:
(pseudo code)
div:id:id/span:class:class/(h5/a/@href or a/@href)
But i can't get it working.
What about something like this, using // on the "variable" hierarchy
div[@id='id']/span[@class]//a[@href]
精彩评论