需要帮助编写Xpath查询字符串

时间:2014-05-09 14:11:13

标签: html xpath

我正在尝试编写一个XPath来从下面的标记中提取值55.3469。但我不知道从哪里开始。

<tr class="uccRes">
<td width="47%" align="right" class="leftCol">100.00&nbsp;<span   class="uccResCde">ALL</span><!-- This is test data. -->
</td>
<td width="6%" valign="middle" align="center">=</td>
<td width="47%" align="left" class="rightCol">55.3469&nbsp;<span class="uccResCde">AFN</span><!-- This is test data. -->
</td>
</tr>

1 个答案:

答案 0 :(得分:0)

首先使用span文字和AFN找到class="uccResCde",然后获取preceding-sibling

//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()