我想使用 xpath 访问特定元素。这是我的 yql 查询结果。看看这个链接 http://developer.yahoo.com/yql/console/#h=select%20content%20from%20html%20where%20url%3D%22http%3A//www.riqapp.be/qld-quaddie.html%22% 20和%20xpath%3D%22//h6[1]%22
<h6>First qld Quaddie</h6>
<h6>second qld quaddie</h6>
我正在使用这个 yql 查询
select content from html where url="http://www.riqapp.be/qld-quaddie.html" and xpath="//h6"
现在我想使用 xpath 访问唯一的第一个元素,其中显示 First qld Quaddie.Plz 在这方面帮助我
提前致谢
最佳答案
使用:
(//h6)[1]
这是 XPath 中最常见的常见问题之一 - XPath []
运算符的优先级高于 //
XPath 伪运算符- 运算符。
关于javascript - 使用 xpath 访问特定元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13535233/