Posts

Showing posts from August, 2013

CSV to XML transformation with WSO2 ESB Smooks Mediator

This post provides a sample CSV to XML transformation with WSO2 ESB. WSO2 ESB supports executing Smooks features through 'Smooks Mediator'. 

Latest ESB can be downloaded from here


We are going to transform the below CSV to an XML message.
Lakmali,Erandi,Female,20,SriLanka Lakmali,Baminiwatta,Female,20,SriLanka
This is the format of the XML output message.
here LakmaliErandiFemale20SriLankaLakmaliBaminiwattaFemale20SriLanka First lets write the smooks configuration to transform above CSV to given XML message (smooks-csv.xml).


<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd"> <resource-config selector="org.xml.sax.driver"> <resource>org.milyn.csv.CSVReader</resource> <param name="fields">firstname,lastname,gender,age,country</param> <param name="rootElementName">people </param> <param name=…