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

后端 未结 3 519
醉话见心
醉话见心 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:49

    The general pattern you're looking for is:

    @*[contains(., 'string')]
    

    which will match any attribute on the context element that contains string. So if you simply want to search the whole document for attributes containing string, you'd use:

    //@*[contains(., 'string')]
    

提交回复
热议问题