这个问题可能有点特殊,但测试程序即时通讯使用XPath来查找我需要的HTML数据。这段HTML(在这里找到)就是我试图解析的东西。XPath文本搜索/兄弟选择
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="textSm" align="right">1. </td> <!-- Location of the number is here -->
<td align="left" nowrap>
<a href="/stats/individual_stats_player.jsp?c_id=sf&playerID=467055" class="textSm">P Sandoval</a> <!-- Player location is here of the number is here -->
</td>
</tr>
</table>
我的目标是通过使用与他对应的号码来找到他的人的名字。这需要我通过包含在“td class="textSm" align="right">1. </td>
”中的特定文本找到节点,然后找到该节点“<td align="left" nowrap>
”的同胞,然后找到该同胞的子节点“<a href="/stats/individual_stats_player.jsp?c_id=sf&playerID=467055" class="textSm">P Sandoval</a>
”以获得期望的结果。我想知道我可以用什么样的查询来找到它。很感谢任何形式的帮助。
好问题(+1)。查看我的答案,了解选择所需节点的单个XPath表达式。 – 2010-07-01 15:42:57