用xpath提取xml值

时间:2019-02-10 15:05:40

标签: xml xpath

具有以下XML:

<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
                   statusCode="200">
   <rest:headers>
      <rest:header name="Date" value="Sun,10 Feb 2019 13:46:02 GMT"/>
      <rest:header name="Transfer-Encoding" value="chunked"/>
      <rest:header name="Content-Type" value="text/xml;charset=utf-8"/>
      <rest:header name="Server" value="Apache-Coyote/1.1"/>
   </rest:headers>
   <rest:payload contentType="text/xml">
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <soapenv:Body>
            <getBatchGroupStatusReturn xmlns="urn:siperian.api">
               <rowidBatchGroupLog>SVR1.ENYY</rowidBatchGroupLog>
               <batchGroupUid>BATCH_GROUP.BPD_STAGE</batchGroupUid>
               <startRunDate>2019-02-10T14:46:02.157+01:00</startRunDate>
               <runStatus>2</runStatus>
            </getBatchGroupStatusReturn>
         </soapenv:Body>
      </soapenv:Envelope>
   </rest:payload>
</rest:RESTResponse>

如何提取“ runStatus”元素的值?我尝试了以下路径:

rest:RESTResponse/rest:payload/soapenv:Envelope/soapenv:Body/getBatchGroupStatusReturn/runStatus

,但这仅在我从父元素中删除xmlns =“ urn:siperian.api”时才有效。但是我无法改变收到的回复。

0 个答案:

没有答案