SlideShare a Scribd company logo
1 of 13
CSV to XML transformation in Mule
Today we will be discussing on transformation
of CSV to XML format of data.
The configuration details for each of the Mule flow
component is explained below.
The first component of the flow is File Endpoint.
The File endpoint is configured to pick up files from specific
location and on completion of processing move it to a pre-
defined location. The developer is free to choose location
as per his/her convenience.
For our demonstration, in the General tab, configure the
following
Path –
C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrcte
stresourcesinput
Move to Directory – C:MuleStudioFileOutbound g
properties with specified values:
Move to Directory –
C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrcte
stresourcesoutput
The next component is logger. The message property value
of the logger component defines the logging statement. In
the General tab, configure the following.
Message – #[string: output #[message]]
The message object provides developer with insights
regarding message’s meta-data.
The contents of the file read by the File endpoint
component is passed to the CSV to Maps component for
conversion to Map data structure. Each line in the CSV file is
converted into an individual Map instance. The individual
Map instances are added to a Collection and passed on to
the next message processor in the flow chain. The
component uses FlatPack project to do file parsing. The
parsed file definition is provided via the mapping file
property. The file needs to be present in the application
classpath. To ensure availability, the person.xml is added in
the src/main/java folder.
In the General tab of the CSV to Maps component configure
the following properties with specific values
Delimiter – ,
Mapping file – person.xml
<?xml version='1.0'?>
<!-- DTD can be pulled from the Jar or over the web-->
<!DOCTYPE PZMAP SYSTEM "flatpack.dtd" >
<!--<!DOCTYPE PZMAP SYSTEM
"http://flatpack.sourceforge.net/flatpack.dtd" >-->
<PZMAP>
<COLUMN name="FIRSTNAME" />
<COLUMN name="LASTNAME" />
<COLUMN name="DOB" />
</PZMAP>
In the Java component’s General tab configure the
following property with specific value.
Class Name – com.vinraj.integration.file.CSVProcessor
The source code of the CSVProcessor is shown below.
package testcsvtoxml;
import java.util.List;
import java.util.Map;
public class CSVProcessor {
public void processFile(List<Map<String, String>> maps) {
System.out.println(maps);
System.out.println("Size: " + maps.size());
}
}
For testin we can use into csv
John,Kent,11/02/1972
Jane,Tully,1/12/1978
Robert,Smith,1/12/1988
Message properties:
INVOCATION scoped properties:
fileAge=1000
moveToDirectory=C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrctestreso
urcesoutput originalDirectory=C:UsersuserAnypointStudioworkspacetestcsvtoxm
INBOUND scoped properties: MULE_ORIGINATING_ENDPOINT=endpoint..C.Users.
user.AnypointStudio.workspace.testcsvtoxml.src.test.resources.input
directory=C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrctestresourcesi
nputlsrctestresourcesinput originalFilename=person.csv
originalFilename=person.csv
fileSize=66
originalDirectory=C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrctestreso
urcesinput
originalFilename=person.csv
timestamp=1464105815396
OUTBOUND scoped properties:
filename=person.csv
SESSION scoped properties:
}
[{FIRSTNAME=John, DOB=11/02/1972, LASTNAME=Kent}, {FIRSTNAME=Jane,
DOB=1/12/1978, LASTNAME=Tully}, {FIRSTNAME=Robert, DOB=1/12/1988,
LASTNAME=Smith}]
Size: 3
The graphic flow is

More Related Content

What's hot

File Connector
File ConnectorFile Connector
File ConnectorThang Loi
 
File connector
File connectorFile connector
File connectorThang Loi
 
Rails DB migrations
Rails DB migrationsRails DB migrations
Rails DB migrationsDenys Kurets
 
Mule Resequencer Filter
Mule Resequencer FilterMule Resequencer Filter
Mule Resequencer FilterAnkush Sharma
 
Mule xml to-jaxb object
Mule xml to-jaxb objectMule xml to-jaxb object
Mule xml to-jaxb objectAnkush Sharma
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traceskunal vishe
 
Pipelining Chem Axon: US UGM 2008
Pipelining Chem Axon: US UGM 2008Pipelining Chem Axon: US UGM 2008
Pipelining Chem Axon: US UGM 2008ChemAxon
 
Manit bhopal group_1_latex_assignment_part_2-1
Manit bhopal group_1_latex_assignment_part_2-1Manit bhopal group_1_latex_assignment_part_2-1
Manit bhopal group_1_latex_assignment_part_2-1Dr. Krishna Mohbey
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshStrawhatLuffy11
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its ModuleJitendra Bafna
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Modelkunj desai
 

What's hot (20)

File Connector
File ConnectorFile Connector
File Connector
 
File connector
File connectorFile connector
File connector
 
Rails DB migrations
Rails DB migrationsRails DB migrations
Rails DB migrations
 
Mule Resequencer Filter
Mule Resequencer FilterMule Resequencer Filter
Mule Resequencer Filter
 
Mule SFTP connector
Mule SFTP connectorMule SFTP connector
Mule SFTP connector
 
Mule xml to-jaxb object
Mule xml to-jaxb objectMule xml to-jaxb object
Mule xml to-jaxb object
 
Ftp connector
Ftp connectorFtp connector
Ftp connector
 
Lift Framework
Lift FrameworkLift Framework
Lift Framework
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
 
Mule Cache Scope
Mule Cache ScopeMule Cache Scope
Mule Cache Scope
 
Pipelining Chem Axon: US UGM 2008
Pipelining Chem Axon: US UGM 2008Pipelining Chem Axon: US UGM 2008
Pipelining Chem Axon: US UGM 2008
 
Manit bhopal group_1_latex_assignment_part_2-1
Manit bhopal group_1_latex_assignment_part_2-1Manit bhopal group_1_latex_assignment_part_2-1
Manit bhopal group_1_latex_assignment_part_2-1
 
Unit3 MapReduce
Unit3 MapReduceUnit3 MapReduce
Unit3 MapReduce
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its ModuleMuleSoft Nashik Virtual  Meetup#3 - Deep Dive Into DataWeave and its Module
MuleSoft Nashik Virtual Meetup#3 - Deep Dive Into DataWeave and its Module
 
Set path
Set pathSet path
Set path
 
shashank_mascots1996_00501002
shashank_mascots1996_00501002shashank_mascots1996_00501002
shashank_mascots1996_00501002
 
Mule RMI transport
Mule RMI transportMule RMI transport
Mule RMI transport
 
Fsmo roles
Fsmo rolesFsmo roles
Fsmo roles
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 

Viewers also liked (16)

My mule esb first http flow
My mule esb first http flowMy mule esb first http flow
My mule esb first http flow
 
Esb choice flow
Esb choice flowEsb choice flow
Esb choice flow
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Transformation jsontoxmlesb
Transformation jsontoxmlesbTransformation jsontoxmlesb
Transformation jsontoxmlesb
 
My mule esb flow
My mule esb flowMy mule esb flow
My mule esb flow
 
Mule esb object_to_jackson_json
Mule esb object_to_jackson_jsonMule esb object_to_jackson_json
Mule esb object_to_jackson_json
 
Transf from csv to xml
Transf from csv to xmlTransf from csv to xml
Transf from csv to xml
 
Mule esb object_to_json
Mule esb object_to_jsonMule esb object_to_json
Mule esb object_to_json
 
Mule esb object_to_json
Mule esb object_to_jsonMule esb object_to_json
Mule esb object_to_json
 
Mule esb db_1
Mule esb db_1Mule esb db_1
Mule esb db_1
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Mule esb db_2
Mule esb db_2Mule esb db_2
Mule esb db_2
 
Rest fullservices
Rest fullservicesRest fullservices
Rest fullservices
 
Mule esb csv_to_json
Mule esb csv_to_jsonMule esb csv_to_json
Mule esb csv_to_json
 
Mule esb file to-string flow
Mule esb file to-string flowMule esb file to-string flow
Mule esb file to-string flow
 

Similar to CSV to XML in Mule

Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxmlGermano Barba
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide俊 朱
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10kunal vishe
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To AntRajesh Kumar
 
Gstreamer plugin devpt_1
Gstreamer plugin devpt_1Gstreamer plugin devpt_1
Gstreamer plugin devpt_1shiv_nj
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's GuideKeyur Shah
 
Oracle RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.Puneet Kala
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpackNodeXperts
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGHitesh Mohapatra
 
How to use source control with apex?
How to use source control with apex?How to use source control with apex?
How to use source control with apex?Oliver Lemm
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake TutorialFu Haiping
 
Spotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creationSpotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creationAmbareesh Kulkarni
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
Cliw - extension development
Cliw -  extension developmentCliw -  extension development
Cliw - extension developmentvicccuu
 
Helm Charts Security 101
Helm Charts Security 101Helm Charts Security 101
Helm Charts Security 101Deep Datta
 
Rest web service_with_spring_hateoas
Rest web service_with_spring_hateoasRest web service_with_spring_hateoas
Rest web service_with_spring_hateoasZeid Hassan
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 

Similar to CSV to XML in Mule (20)

Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxml
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 
Gstreamer plugin devpt_1
Gstreamer plugin devpt_1Gstreamer plugin devpt_1
Gstreamer plugin devpt_1
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 
OMG D&C Tutorial
OMG D&C TutorialOMG D&C Tutorial
OMG D&C Tutorial
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
Oracle RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDINGWORKING WITH FILE AND PIPELINE PARAMETER BINDING
WORKING WITH FILE AND PIPELINE PARAMETER BINDING
 
How to use source control with apex?
How to use source control with apex?How to use source control with apex?
How to use source control with apex?
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 
Spotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creationSpotfire Integration & Dynamic Output creation
Spotfire Integration & Dynamic Output creation
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
PPT_CC.pptx
PPT_CC.pptxPPT_CC.pptx
PPT_CC.pptx
 
Cliw - extension development
Cliw -  extension developmentCliw -  extension development
Cliw - extension development
 
Helm Charts Security 101
Helm Charts Security 101Helm Charts Security 101
Helm Charts Security 101
 
Rest web service_with_spring_hateoas
Rest web service_with_spring_hateoasRest web service_with_spring_hateoas
Rest web service_with_spring_hateoas
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 

More from Davide Rapacciuolo

More from Davide Rapacciuolo (10)

Muleesbobjecttojson
Muleesbobjecttojson Muleesbobjecttojson
Muleesbobjecttojson
 
Consuming raml
Consuming ramlConsuming raml
Consuming raml
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Transformation jsontoxmlesb
Transformation jsontoxmlesbTransformation jsontoxmlesb
Transformation jsontoxmlesb
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesb
 
Mule esb expression_filter
Mule esb expression_filterMule esb expression_filter
Mule esb expression_filter
 
Mule esb collection_splitter
Mule esb collection_splitterMule esb collection_splitter
Mule esb collection_splitter
 
Mule esb soap_service
Mule esb soap_serviceMule esb soap_service
Mule esb soap_service
 
Json to json transformation in mule
Json to json transformation in muleJson to json transformation in mule
Json to json transformation in mule
 
Mule esb json_to_object
Mule esb json_to_objectMule esb json_to_object
Mule esb json_to_object
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

CSV to XML in Mule

  • 1. CSV to XML transformation in Mule
  • 2. Today we will be discussing on transformation of CSV to XML format of data. The configuration details for each of the Mule flow component is explained below. The first component of the flow is File Endpoint.
  • 3. The File endpoint is configured to pick up files from specific location and on completion of processing move it to a pre- defined location. The developer is free to choose location as per his/her convenience. For our demonstration, in the General tab, configure the following Path – C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrcte stresourcesinput Move to Directory – C:MuleStudioFileOutbound g properties with specified values:
  • 4. Move to Directory – C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrcte stresourcesoutput The next component is logger. The message property value of the logger component defines the logging statement. In the General tab, configure the following. Message – #[string: output #[message]] The message object provides developer with insights regarding message’s meta-data.
  • 5. The contents of the file read by the File endpoint component is passed to the CSV to Maps component for conversion to Map data structure. Each line in the CSV file is converted into an individual Map instance. The individual Map instances are added to a Collection and passed on to the next message processor in the flow chain. The component uses FlatPack project to do file parsing. The parsed file definition is provided via the mapping file property. The file needs to be present in the application classpath. To ensure availability, the person.xml is added in the src/main/java folder.
  • 6. In the General tab of the CSV to Maps component configure the following properties with specific values Delimiter – , Mapping file – person.xml
  • 7. <?xml version='1.0'?> <!-- DTD can be pulled from the Jar or over the web--> <!DOCTYPE PZMAP SYSTEM "flatpack.dtd" > <!--<!DOCTYPE PZMAP SYSTEM "http://flatpack.sourceforge.net/flatpack.dtd" >--> <PZMAP> <COLUMN name="FIRSTNAME" /> <COLUMN name="LASTNAME" />
  • 8. <COLUMN name="DOB" /> </PZMAP> In the Java component’s General tab configure the following property with specific value. Class Name – com.vinraj.integration.file.CSVProcessor The source code of the CSVProcessor is shown below.
  • 9. package testcsvtoxml; import java.util.List; import java.util.Map; public class CSVProcessor { public void processFile(List<Map<String, String>> maps) { System.out.println(maps); System.out.println("Size: " + maps.size()); } }
  • 10. For testin we can use into csv John,Kent,11/02/1972 Jane,Tully,1/12/1978 Robert,Smith,1/12/1988
  • 11. Message properties: INVOCATION scoped properties: fileAge=1000 moveToDirectory=C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrctestreso urcesoutput originalDirectory=C:UsersuserAnypointStudioworkspacetestcsvtoxm INBOUND scoped properties: MULE_ORIGINATING_ENDPOINT=endpoint..C.Users. user.AnypointStudio.workspace.testcsvtoxml.src.test.resources.input directory=C:UsersuserAnypointStudioworkspacetestcsvtoxmlsrctestresourcesi nputlsrctestresourcesinput originalFilename=person.csv
  • 13. [{FIRSTNAME=John, DOB=11/02/1972, LASTNAME=Kent}, {FIRSTNAME=Jane, DOB=1/12/1978, LASTNAME=Tully}, {FIRSTNAME=Robert, DOB=1/12/1988, LASTNAME=Smith}] Size: 3 The graphic flow is