How can I get JDOM/XPath to ignore namespaces?

后端 未结 4 1592
轮回少年
轮回少年 2021-01-18 19:35

I need to process an XML DOM, preferably with JDOM, where I can do XPath search on nodes. I know the node names or paths, but I want to ignore namespaces completely<

4条回答
  •  遥遥无期
    2021-01-18 20:27

    /ns:foo/ns:bar/@baz
    

    becomes

    /*[local-name() = 'foo']/*[local-name() = 'bar']/@baz
    

    You get the point. Don't expect that to be lightning-fast either.

提交回复
热议问题