Select xml 当兄弟元素文本节点等于给定值时的节点

Select xml nodes when sibling elements text node equals given value

以下为SOAP答案:

   <dep:deposit>
       <dep:agreementData>
          <dm:ReferenceId>634_24570</dm:ReferenceId>
          <dm:status>
             <dm:code>STCLOSEOUT</dm:code>
             <dm:name>STCLOSEOUT</dm:name>
          </dm:status>
          <dm:code>133</dm:code>
          <dm:amount>5000</dm:amount>
          <dm:currency>EUR</dm:currency>
          <dm:documentDate>2015-12-11</dm:documentDate>
          <b:refer>3013011512126177799</b:refer>
          <b:product>
             <dm:code>3.7.1.EU</dm:code>
             <dm:name>Deposit EUR new</dm:name>
          </b:product>
          <b:department>
             <dm:code>301</dm:code>
          </b:department>
          <b:dateFrom>2015-12-11</b:dateFrom>
          <b:dateTo>2016-12-11</b:dateTo>
          <b:deaClient>
             <dm:code>0300.000306</dm:code>
          </b:deaClient>
          <b:balanceDep>
             <dm:code>301</dm:code>
          </b:balanceDep>
          <b:serviceDep>
             <dm:code>301</dm:code>
          </b:serviceDep>
          <b:salesDep>
             <dm:code>301</dm:code>
          </b:salesDep>
          <b:arrestFl>0</b:arrestFl>
          <dep:depoTermTU>12.0</dep:depoTermTU>
          <dep:depoTermTimeType>M</dep:depoTermTimeType>
          <dep:lockFl>0</dep:lockFl>
       </dep:agreementData>
    </dep:deposit>

其中 deposit 元素的 status/code 可以获得不同的值:

      <dm:status>
         <dm:code>STCLOSEOUT</dm:code>
         <dm:name>STCLOSEOUT</dm:name>
      </dm:status>

How to use XPATH to get dm:ReferenceId with a specific status code, for example, STCLOSEOUT. I want to use in SOAPUI test, Transfer properties.

我将不胜感激,谢谢!

使用以下 xpath 查询:

//dm:status/dm:code[text()='STCLOSEOUT']/../../dm:ReferenceId

描述:

  • 对于任何 dm:status 元素
  • select 文本节点等于 STCLOSEOUTdm:code 子节点(或任何您想要的代码)
  • 两次上升到dep:agreementData和return dm:ReferenceId

演示:http://xpather.com/alhDD360