muledevlepoer07
muledevlepoer07

Reputation: 47

mule datamapper xml to csv conversion

Below is my xml input:

<projects>
    <project>
        <name >project1</name> 
        <language>java</language> 
    </project>
    <project>
        <name>project2</name> 
        <language>mainframe</language>  
    </project>
</projects>

I want to convert this .xml to .csv file using data-mapper, but unfortunately it doesn't work.

Can anyone send me the sample flow xml for that? It is very important for my project now.

Upvotes: 1

Views: 885

Answers (1)

Rupesh Sinha
Rupesh Sinha

Reputation: 158

This is a very simple requirement. You should select your sample XML file in the input section of the datamapper and define a user defined output of type CSV. Once you create a mapping, map the fields from XML (input) to CSV (output). The code would like as below.

//MEL
//START -> DO NOT REMOVE
output.__id = str2long(input.__id);
//END -> DO NOT REMOVE

output.name = input.name;
output.language = input.language;

You can now click on Preview button and run the preview with your sample XML file. Wasn't that easy? Try this and let me if any issues.

Upvotes: 0

Related Questions