如何使用“不”在xpath? [英] How to use "not" in xpath?

查看:92
本文介绍了如何使用“不”在xpath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一些类似的东西:

I want to write something of the sort:

//a[not contains(@id, 'xx')]

(意思是id属性的所有链接不包含字符串xx )

(meaning all the links that there 'id' attribute doesn't contain the string 'xx')

我找不到正确的语法。

推荐答案

not()是xpath中的一个函数(而不是一个运算符),所以

not() is a function in xpath (as opposed to an operator), so

//a[not(contains(@id, 'xx'))]

这篇关于如何使用“不”在xpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆