且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要过滤具有特定值的任何属性

更新时间:2023-01-17 18:19:24

此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']/@*