xml xpath:查找具有给定属性的节点,该属性的值包含一个字符串
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/614797/
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
xpath: find a node that has a given attribute whose value contains a string
提问by flybywire
Is there an xpath way to find a node that has a given attribute whose value contains a given string?
是否有 xpath 方法来查找具有给定属性的节点,该属性的值包含给定字符串?
For example I have an xml document and want to find a node where the addressattribute contains the string Downing, so that I could find the following node:
例如,我有一个 xml 文档,想找到一个address属性包含 string的节点Downing,以便我可以找到以下节点:
<person name="blair" address="10 Downing St. London"/>
回答by vartec
select="//*[contains(@address,'Downing')]"

