How to find elements by attribute namespace in XPath

后端 未结 4 1997
春和景丽
春和景丽 2020-12-05 01:06

I\'m trying to use XPath to find all elements that have an element in a given namespace.

For example, in the following document I want to find the foo:bar

4条回答
  •  一生所求
    2020-12-05 01:17

    Your XPath expression is almost perfect. Instead of asking for attributes "@" ask for elements "" and it should work:

    "//*[namespace-uri()='http://foo.example.com']"
    

提交回复
热议问题