xhtml - xpath 查找没有类和 id 的节点

标签 xhtml xpath css-selectors

如何在 xhtml 文档中查找没有 id 和 class 属性的节点?

最佳答案

来自@astropanic(OP)的评论:

I want all li nodes that doesn't have id or class attributes



使用 :
//li[not(@id) and not(@class)]

这将选择所有 li XML 文档中的元素,例如 li元素没有 id并且没有 class属性。

关于xhtml - xpath 查找没有类和 id 的节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4512890/

相关文章:

c# - 我应该使用什么来代替 "align"属性

php - 突出显示事件链接

html - XHTML……它还有意义吗?

ruby - 如何在现有元素周围包裹div?

android - 无法使用带有 Appium 的 xpath 找到元素(机器人框架)

html - CSS Navigation Sprite - 奇怪的形状(不是正方形)

python - 如何在源代码(Xpath)中查找特定字符串并提取后续文本?

html - 如何使用:before for the third <li> element?

html - 将 CSS 应用于除某些类后代之外的任何元素?

css - 如何在 CSS 中处理带有 '.' 的 id 标签