我是XPath的完全noob,我正在申请从网站获取数据,我需要找到两件事:
1-所有以ctl00_Main_GridView_lieutenants
2- span-.....r的父标签的href ..我将尝试解释:
<a href="something.html"><span id="ctl00_Main_GridView_lieutenants_ctl03_lbl_nick">Text</span></a>
我需要文字和链接;)
答案 0 :(得分:11)
//span[starts-with(@id, 'ctl00_Main_GridView_lieutenants')]
选择@id
以ctl00_Main_GridView_lieutenants
//a[span[starts-with(@id, 'ctl00_Main_GridView_lieutenants')]]/@href
选择所有@href
a
个span
个@id
ctl00_Main_GridView_lieutenants
以{{1}}