需要过滤具有特定值的任何属性 [英] need to filter any attribute with specific value

查看:73
本文介绍了需要过滤具有特定值的任何属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取具有特定文本的任何属性。


如何在xpath语法中执行此操作?试过// * [@ * =='测试'], // @ * =='测试' 没有好处


我会采取linq方法同样。

解决方案

此xpath将返回包含值为"test"的属性的节点。 b $ b // * [@ * ='test']


此xpath将返回属性本身

// * [@ * ='Test' ] / @ *


i want to grab any attribute with specific text.

how to do that in xpath syntax ? tried //*[@*=='test'] , //@*=='test' no good

I will take linq approach as well.

解决方案

This xpath will return the nodes containing an attribute with a value of "test"
//*[@*='test']

This xpath will return the attributes themselves
//*[@*='Test']/@*


这篇关于需要过滤具有特定值的任何属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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