加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Xml命名空间打破我的xpath!

发布时间:2020-12-16 01:57:44 所属栏目:百科 来源:网络整理
导读:我有以下XML: List xmlns="http://schemas.microsoft.com/sharepoint/soap/" Fields Field /Field /Fields/List 这是从SharePoint Web服务返回的XML的精简版本。我也有以下xPath: /List/Fields/Field 当我从我的XML删除xmlns xPath工作正常。当它在我的xPa
我有以下XML:
<List xmlns="http://schemas.microsoft.com/sharepoint/soap/">
 <Fields>
   <Field>
   </Field>
 </Fields>
</List>

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

/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”):

/x:List/x:Fields/x:Fiels

那么还有另一种方法:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读