这个问题可能有点具体,但我正在编写的测试程序使用 XPath 在 HTML 中查找我需要的数据。这段 HTML(在此处找到)是我试图解析的内容。
<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>
”以获得所需的结果。我想知道我可以使用什么样的查询来找到这个。很感谢任何形式的帮助。