Xpath to search for a node that has ANY attribute containing a specific string?

后端 未结 3 521
醉话见心
醉话见心 2020-12-16 16:09

I can search for a String contained in an specific attribute if I use the following XPath /xs:schema/node()/descendant::node()[starts-with(@my-specific-attrib

3条回答
  •  春和景丽
    2020-12-16 16:37

    Sample XML:

    
      
      
      
    
    

    Suppose, we need to select elements which have any attribute containing h. In this sample: element1, element2. We can use this XPath:

    //*[@*[starts-with(., 'h')]]
    

    In your sample:

    /xs:schema/node()/descendant::node()
        [@*[starts-with(@my-specific-attribute-name-here, 'my-search-string')]]
    

提交回复
热议问题