xml - 使用 xpath 提取 xml 值
问题描述
让我们有以下 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" 时才有效。但我不能对收到的回复做任何改变。
解决方案
推荐阅读
- c - 使用 C 代码中更新的编译器工具链摆脱“表达式必须是常量值”
- python - Pandas 删除重复项的行为不符合预期
- ruby-on-rails - 在同一个 Bucket 中过滤两个数据 Searchkick Ruby on Rails
- powerbi - DAX 计算 - 最近 2 天的 SUM 销售额
- c - 如何在我的 C 限制下检查用户的有效输入?
- ios - 从多个 Mac 编译 iOS 应用程序
- php - 在 TCPDF 中未内联的图像
- reactjs - React Native:当我在 Xcode 中单击字体文件时,“无法识别的字体系列”错误消失了
- hive - AZURE Blob 存储上的 Hive ORC ACID 表可用于 MERGE
- powerbi - Power BI 如果列等于此值且大于此值,则为百分比