When you use DataWeave component, you need to declare xml namespaces. If you are using Studio designer, then Studio adds related namespaces as soon as you drag and drop components to your configuration.
So when you drag and drop dataweave component, studio would add below namespaces and schema location to config -
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
In Mule, you can define MetaData for every component which would help to see data structure at design time. All these metadata definitions are stored under {project_home}\catalog
folder with file names that looks like UUID
. These file names are then added to your component definitions with metadata:id
attribute. You need metadata namespace even if one component (doesnt have to DW as metadata is feature common to all components).
<dw:transform-message metadata:id="262e6569-8f38-4e0b-a61d-15550870101e" doc:name="Transform Message">
If you add metadata from Studio designer then Studio should automatically add below namespace and schema location. If you add it manually or copy-paste from one xml to another which doesn't have it then you would need to add it your self -
xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata"
Example config with Dataweave and metadata can look like below -
<mule xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">