如何将xpath写入checkAddResult值

问题描述 投票:0回答:1

如何编写XPath以获取AddResult文本值

  <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <soap:Body>
       <AddResponse xmlns="http://tempuri.org/">
         <AddResult>128</AddResult>
       </AddResponse>
     </soap:Body>
  </soap:Envelope>

我在下面尝试过但没有得到想要的结果

declare namespace soap='http://www.w3.org/2003/05/soap-envelope';
/soap:Envelope/soap:Body/AddResponse/AddResult/text()
xpath soapui
1个回答
0
投票

Found Answeer:

我应该使用与响应xml中相同的URL创建另一个名称空间,并在xpath中使用,下面是答案

declare namespace soap='http://www.w3.org/2003/05/soap-envelope';
declare namespace xmlns='http://tempuri.org/';
/soap:Envelope/soap:Body/xmlns:AddResponse/xmlns:AddResult/text()
© www.soinside.com 2019 - 2024. All rights reserved.