在mulesoft的DWL2.0中,如何在xml头标记中定义多个名称空间?

在mulesoft的DWL2.0中,如何在xml头标记中定义多个名称空间?,xml,mule,dataweave,mulesoft,mule-esb,Xml,Mule,Dataweave,Mulesoft,Mule Esb,成功 如何在DWL2.0中包含两个名称空间?您的意思是在XML输出中只使用两个XML名称空间 %dw 2.0 output application/xml ns orders http://www.acme.com/shemas/Orders ns stores http://www.acme.com/shemas/Stores --- root: orders#orders: { stores#shipNodeId: "SF01", stores#s

成功


如何在DWL2.0中包含两个名称空间?

您的意思是在XML输出中只使用两个XML名称空间

%dw 2.0
output application/xml
ns orders http://www.acme.com/shemas/Orders
ns stores http://www.acme.com/shemas/Stores
---
root:
    orders#orders: {
        stores#shipNodeId: "SF01",
        stores#shipNodeId @(shipsVia:"LA01"): "NY03"
    }
输出:

<?xml version='1.0' encoding='UTF-8'?>
<root>
  <orders:orders xmlns:orders="http://www.acme.com/shemas/Orders">
    <stores:shipNodeId xmlns:stores="http://www.acme.com/shemas/Stores">SF01</stores:shipNodeId>
    <stores:shipNodeId xmlns:stores="http://www.acme.com/shemas/Stores" shipsVia="LA01">NY03</stores:shipNodeId>
  </orders:orders>
</root>

SF01
NY03
摘自文档中的食谱:

我用@(xmlns#new:)解决了它