Contact Free trial Login

Include XML Namespaces

This DataWeave example defines different namespaces in the header and then references them on each tag.

This example uses:

  • namespace definitions in the header.

  • @ to define other attributes in an XML element.

%dw 2.0
output application/xml
ns orders
ns stores
    orders#orders: {
        stores#shipNodeId: "SF01",
        stores#shipNodeId @(shipsVia:"LA01"): "NY03"
<?xml version='1.0' encoding='US-ASCII'?>
  <po:order xmlns:po="">
    <store:shipNodeId xmlns:store="">SF01</store:shipNodeId>
    <store:shipNodeId xmlns:store="" shipsVia="LA01">NY03</store:shipNodeId>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.