Convert data to XML with multiple namespace in root element in Dataweave 2.0 Mule 4

The following dataweave code converts attributes to xml payload with namespace in Anypoint studio.

Here the speciality is to keep the second namespace for the inner elements in the root atribute in the xml payload. Generally dataweave doesn’t allow for two namespaces in the root element.

Please find the code below for your reference.

https://gist.github.com/ravitejagrt/9e4172acca1d1d515ca5978686b385dd

--

--