I'm trying to create a custom Dataweave module for centralizing my custom XML namespaces.
I followed the official document of Mulesoft:https://docs.mulesoft.com/mule-runtime/4.3/dataweave-create-module
it states that: "When you import a custom module into another DataWeave script, any functions, variables, types, and namespaces defined in the module become available for use in the DataWeave body".
So I was expecting that I could create a module (in modules folder) containing my namespaces like this: Namespaces.dwl
ns myNs1 http://namespaces/my1
ns myNs2 http://namespaces/my2
import that module in another Dataweave like this:
%dw 2.0
import * from modules::Namespaces
output application/java
---
{
body: {
myNs1#Response: {
outcome: 'ACCEPTED'
}
} write "application/xml"
}
But I got this error:
The prefix myNs1 has not been previously declared using ns
I'm running on Mule 4.3.0