2. As we know, there can be multiple types of payload
we need to deal daily, starting from JSON, XML or
String, we also require different type of data
transformation in our application like XML to JSON,
JSON to XML or String etc . In Mule application, we
have a various set of transformers that we can use
to obtain our required data format.
3. Today we will be discussing on transformation
of XML to XML format of data.
Yuo will realize how easy it is to perform such type
of transformation in Mule. Here we will take the
same example, but will be doing it on XML instead
of JSON this time.
So, let us consider, we have the following XML
payload as an input to our application
5. So, now if this XML data is coming as an input and we
require to transform/modify the payload into another
XML format and produce it as an output, something
like the following:
<RootTag>
<name>Sebastian Ritch</name>
<id>60</id>
<designation>Manager</designation>
</RootTag>
6. And here you can see the modified XML has a new
element designation as a third element . Now,
the challenge here is to modify the existing input
XML payload and to design an output XML payload from
it, which will contain this additional element in it with
the same format.
So, how can we transform/modify the payload into
another XML format in an easy way. We know Mule has
extremely powerful tools called Datamapper but that
limited to Mule enterprise edition.
7. A simple way of doing it is using XSLT in Mule. Mule
do have XSLT support in it’s flow, which makes the
life of a developer easy
in transforming/modifying XML in the required
format.
So, here is the Mule flow which can be use to
transform XML payload from one format to another
using XSLT