JAXB bindings file: namespace-aware node selection

£可爱£侵袭症+ 提交于 2019-12-05 22:50:50

Is there any way to construct the XPath expression without relying on knowledge of the prefix, only the namespace URI?

If you talk about an attribute value, this is XPath 1.0

.//xs:element[
   namespace::*[
      . = 'www.acme.com'
   ][
      susbtring-before(
         ../@ref,
         ':'
      )
    = name()
   ]
 and
   substring(
      concat(':', @ref),
      string-length(@ref) - 1
   )
 = 'el1'
]

In XPath 2.0 is much more simple:

.//xs:element[resolve-QName(@ref,.) eq QName('www.acme.com','el1')]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!