且构网

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

如何使用 XPath 在具有命名空间的 XML 文档中查找所有文本节点?

更新时间:2023-11-07 12:16:46

文本节点上没有命名空间;您的 three 节点只包含文本 foo:Delta,它在 XML 中没有特殊含义.您可以使用 starts-with:

There is no such thing as a namespace on a text node; your three node just contains the text foo:Delta, which has no special meaning in XML. You can find nodes holding text starting with foo: using starts-with:

//*[starts-with(., "foo:")]