1

我在代理服务中使用 wso2 EI 6.5.0 我需要在这两个标签之间获取元素<aa></aa>

xpath //tem:Request 工作但 /tem:Request/xDoc/aa 不工作

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
       <soapenv:Header/>
       <soapenv:Body>
          <tem:Request>
             <xDoc>
                <aa>
                   <bb>
                        ....
                   </bb>
                   <cc>
                      <Parameter>
                        ......
                      </Parameter>
                   </cc>
                </aa>
             </xDoc>
          </tem:Request>
       </soapenv:Body>
    </soapenv:Envelope>
4

1 回答 1

1

您必须使用/soapenv:Envelope/soapenv:Body/tem:Request/xDoc/aa$body/tem:Request/xDoc/aa

在 xpath 中使用“//”的目的是直接访问特定元素。但是如果我们使用“/”,我们需要指定整个路径来遍历XML标签并到达特定的元素。

另一方面,如果你想访问标签,<aa/>那么你可以直接使用 xpath //aa

于 2019-12-19T04:25:16.843 回答