XML + XPATH: Any way to work with a default Namespace?

╄→гoц情女王★ 提交于 2019-11-29 15:23:37

Assign http://somenamespace.com/ to a namespace prefix, say "def", and use that in your XPath expression:

/soap:Envelope/soap:Body/def:CreateCIInStockResponse/def:Data

How to assign the prefix will vary depending on your XPath processor.

Updated: Alternative approach if assigning a prefix is not an option:

/soap:Envelope/soap:Body/*[local-name()='CreateCIInStockResponse']/*[local-name()='Data']

To make absolutely sure that you're accessing the elements you expect, you might add namespace-uri() = 'http://somenamespace.com/' as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!