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

xml – 无法在soapUI中使用xpath获取节点

发布时间:2020-12-16 23:06:45 所属栏目:百科 来源:网络整理
导读:如何使用soapUI 4.0.0中的Xpath从以下响应文件访问“AccountId”节点? 提前致谢. 响应文件如下, s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:Body GetResponse xmlns="http://www.xyz.com/cmw/tcm/account" GetResult xmlns:i="http
如何使用soapUI 4.0.0中的Xpath从以下响应文件访问“AccountId”节点?

提前致谢.

响应文件如下,

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetResponse xmlns="http://www.xyz.com/cmw/tcm/account">
         <GetResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <Account>
               <AccountId>14338049839</AccountId>
               <AccountLabel>Spara Femman</AccountLabel>
               <AccountRoleDTOList>
                  <AccountRole>
                     <AddressTypeId>REC</AddressTypeId>
                     <EndDay i:nil="true"/>
                     <ExtPosReference i:nil="true"/>
                     <HolderId>10533</HolderId>
                     <HolderName>T?RNHOLMS HOTELL AB</HolderName>
                     <HolderTypeId>COR</HolderTypeId>
                     <IdentificationId>005164006917</IdentificationId>
                     <ReportProfileId>3</ReportProfileId>
                     <ReportProfileName>Standard</ReportProfileName>
                     <RoleDocumentPath i:nil="true"/>
                     <RoleId>HOL</RoleId>
                     <RoleName>Holder</RoleName>
                     <ShareOfAccount>100.00000</ShareOfAccount>
                  </AccountRole>
               </AccountRoleDTOList>
               <AccountTypeId>AGG</AccountTypeId>
               <CloseDay i:nil="true"/>
               <CurrencyId>SEK</CurrencyId>
               <CustodianAccountId i:nil="true"/>

我通过使用以下代码尝试了它…但它不起作用

declare namespace i='http://www.w3.org/2001/XMLSchema-instance';
//i:GetResult[1]/Account[1]

但我得到的错误就像,
缺少xpath声明命名空间的内容i =’http://www.w3.org/2001/XMLSchema-instance‘;
// i:GetResult [1] /帐户[1]作为回应

解决方法

试试这个

declare namespace i='http://www.w3.org/2001/XMLSchema-instance';
//i:GetResult[1]/i:Account[1]

要么

declare namespace i='http://www.w3.org/2001/XMLSchema-instance';
//i:GetResult[1]/*:Account[1]

(编辑:李大同)

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

    推荐文章
      热点阅读