Xml命名空间打破我的xpath!

前端之家收集整理的这篇文章主要介绍了Xml命名空间打破我的xpath!前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有以下XML: @H_404_1@<List xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <Fields> <Field> </Field> </Fields> </List>

这是从SharePoint Web服务返回的XML的精简版本。我也有以下xPath:

@H_404_1@/List/Fields/Field

当我从我的XML删除xmlns xPath工作正常。当它在我的xPath找不到任何东西。有什么我应该做不同的我的xPath?修改XML不是一个选项。

I also have the following xPath:

06000

When I remove the xmlns from my XML
the xPath works fine. When it’s in
there my xPath finds nothing

如果你不能注册一个命名空间绑定,不能使用(假设注册的前缀是“x”):

@H_404_1@/x:List/x:Fields/x:Fiels

那么还有另一种方法

@H_404_1@/*[name()='List']/*[name()='Fields']/*[name()='Field']

猜你在找的XML相关文章