如何忽略xpath中的第一个元素 [英] How to ignore first element in xpath
本文介绍了如何忽略xpath中的第一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何忽略第一个元素并获取其余元素?
How can I ignore first element and get rest of the elements?
<ul>
<li><a href="#">some link</a></li>
<li><a href="#">some link 2</a></li>
<li><a href="#">link i want to find</a></li>
</ul>
谢谢
推荐答案
如果您只想忽略第一个"元素:
if you want to ignore the "first" element only then:
//li[position()>1]
or
(//a)[position()>1]
如果你只想要最后一个(就像你的例子似乎暗示的那样):
if you want the last only (like your example seems to suggest):
//li[last()]
or
(//a)[last()]
这篇关于如何忽略xpath中的第一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文