首页 > 解决方案 > 加载 xml 文件后更新值

问题描述

我正在使用readUrl命令加载以下 xml 文件

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <a>
         <b>xyz</b>
         <c>
            <d>false</d>
            <e>false</e>
            <f>true</f>
         </c>
      </a>
   </soapenv:Body>
</soapenv:Envelope>

在与 readUrl 命令相同的数据编织中 - 我想将 xmle值更新falsetrue

有人可以帮忙吗

干杯,

强尼

标签: muledataweaveanypoint-studiomulesoft

解决方案


使用 Mule 4.3.0 中可用的更新运算符可用于根据需要更新值:

%dw 2.0
output application/xml
ns soapenv http://schemas.xmlsoap.org/soap/envelope/
var soapMessage=readUrl("...","application/xml")
---
soapMessage update {
        case .soapenv#Envelope.soapenv#Body.a.c.e -> true
}

推荐阅读