是否存在一个XPath表达式,该表达式将返回以下文档中<a>
之后的所有<span>
元素?即:[y,z]
。
<table>
<tr>
<td>
<a href="x">x</a>
<span>s</span>
<a href="y">y</a>
<a href="z">z</a>
</td>
</tr>
</table>
最佳答案
试试这个XPath:
//a[preceding-sibling::span]
关于xml - 需要在特定元素之后获取所有元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7688160/