xpath连接soap有效负载值

时间:2017-08-12 19:38:24

标签: xpath

我有以下代码作为API调用的肥皂体。我需要将这些值设为'#06164F4' 00000116',#39; ## 00000130'和值继续..单引号和逗号分隔。我尝试使用concat和string-join,但无法获得准确的输出。如何从肥皂体有效负载中获取所有TOLL_NUMBER。

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v1="http://www.oracle.com/Argus/Contract/v1.0" xmlns:v11="http://www.oracle.com/Argus/Types/v1.0">
   <soap:Header/>
   <soap:Body>
      <ns0:SFT_MSG ns1:Type="Request" ns1:EnterpriseShortName="ns0:EnterpriseShortName_1" xmlns:ns1="http://www.oracle.com/Argus/Base/v1.0" xmlns:ns0="http://www.oracle.com/Argus/TOLL_Request/v1.0">
  <ns0:TOLL_LOOKUP>
    <ns0:TOLL>
      <ns2:TOLL_NUMBER xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">#06164F4</ns2:TOLL_NUMBER>
      <ns2:EXPIRATION_DATE xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">ns1:EXPIRATION_DATE_0</ns2:EXPIRATION_DATE>
    </ns0:TOLL>
    <ns0:TOLL>
      <ns2:TOLL_NUMBER xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">00000116</ns2:TOLL_NUMBER>
      <ns2:EXPIRATION_DATE xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">ns1:EXPIRATION_DATE_0</ns2:EXPIRATION_DATE>
    </ns0:TOLL>
    <ns0:TOLL>
      <ns2:TOLL_NUMBER xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">##00000130</ns2:TOLL_NUMBER>
      <ns2:EXPIRATION_DATE xmlns:ns2="http://www.oracle.com/Argus/Entity/v1.0">ns1:EXPIRATION_DATE_0</ns2:EXPIRATION_DATE>
    </ns0:TOLL>
  </ns0:TOLL_LOOKUP>
  <ns1:EXTENSION>
    <ns1:CUSTOM ns1:Name="ns0:Name_0" ns1:Metadata="ns0:Metadata_1">ns0:CUSTOM_0</ns1:CUSTOM>
    <ns1:SFT_MSG_ELEMENT>
      <any0>anyContents0</any0>
    </ns1:SFT_MSG_ELEMENT>
  </ns1:EXTENSION>
</ns0:SFT_MSG>
   </soap:Body>
</soap:Envelope>

1 个答案:

答案 0 :(得分:0)

使用XPath 2.0,您可以结合使用concat()string-join() ......

concat("&apos;",string-join(//*:TOLL_NUMBER,"&apos;,&apos;"),"&apos;")

注意:最好将名称空间uri http://www.oracle.com/Argus/Entity/v1.0绑定到前缀并使用该名称而不是*:TOLL_NUMBER