且构网

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

如何在XPath中按属性名称空间查找元素

更新时间:2023-12-06 17:33:28

使用:

//*[namespace-uri()='yourNamespaceURI-here'
   or
    @*[namespace-uri()='yourNamespaceURI-here']
   ]

谓词两个条件由XPath or运算符排序.

the predicate two conditions are or-ed with the XPath or operator.

XPath表达式因此选择了以下任一元素:

The XPath expression thus selects any element that either:

  • 属于指定的名称空间.
  • 具有属于指定名称空间的属性.