xml 如何选择具有特定属性的所有元素?使用 TinyXPath
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5617692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 14:39:02 来源:igfitidea点击:
How to select all elements with a specific attribute? with TinyXPath
提问by eugene
What is the XPath expression for selecting all elements with attribute A?
用于选择具有属性 A 的所有元素的 XPath 表达式是什么?
const char* xpath = "//\*/\*[@A]"
回答by Mads Hansen
This XPath selects all elements that have an A attribute:
此 XPath 选择所有具有 A 属性的元素:
//*[@A]

