I recently figured out how to add default namespaces in XML by consulting this doc page.
%dw 2.0
output application/xml
var dns = {uri: "http://api.acme.com/customer", prefix: ""} as Namespace
---
dns#customer: {
dns#name: "Max",
dns#city: "LA"
}
Which generates the following xml:
<?xml version='1.0' encoding='UTF-8'?>
<customer xmlns="http://api.acme.com/customer">
<name>Max</name>
<city>LA</city>
</customer>
Is there any other way using the ns declaration? Any documentation on the Namespace type? I can't find any.