SlideShare a Scribd company logo
1 of 13
CSV to XML transformation in Mule
BY
NAGARJUNA REDDY
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:Usersantonio.pellegrinoAnypointStudioworkspacetestcsvtox
mlsrctestresourcesinput
Move to Directory – C:MuleStudioFileOutbound g properties
with specified values:
Move to Directory –
C:Usersantonio.pellegrinoAnypointStudioworkspacetestcsvtox
mlsrctestresourcesoutput
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:Usersantonio.pellegrinoAnypointStu
dioworkspacetestcsvtoxmlsrctestresourcesoutput
originalDirectory=C:Usersantonio.pellegrinoAnypointStud
ioworkspacetestcsvtoxm
INBOUND scoped properties:
MULE_ORIGINATING_ENDPOINT=endpoint..C.Users.antonio
.pellegrino.AnypointStudio.workspace.testcsvtoxml.src.test.r
esources.input
directory=C:Usersantonio.pellegrinoAnypointStudiowork
spacetestcsvtoxmlsrctestresourcesinputlsrctestresou
rcesinput originalFilename=person.csv
originalFilename=person.csv
fileSize=66
originalDirectory=C:Usersantonio.pellegrinoAnypointStud
ioworkspacetestcsvtoxmlsrctestresourcesinput
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

Mule Resequencer Filter
Mule Resequencer FilterMule Resequencer Filter
Mule Resequencer FilterAnkush Sharma
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Modelkunj desai
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Pooja Talreja
 
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow TasksPramod Singla
 
File Connector
File ConnectorFile Connector
File ConnectorThang Loi
 
File connector
File connectorFile connector
File connectorThang Loi
 
5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow BasicsPramod Singla
 
Apache lb
Apache lbApache lb
Apache lbKsd Che
 
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
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traceskunal vishe
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshStrawhatLuffy11
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Databaseakashdprajapati
 
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
 
3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asksPramod Singla
 

What's hot (20)

Mule Resequencer Filter
Mule Resequencer FilterMule Resequencer Filter
Mule Resequencer Filter
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
Ftp connector
Ftp connectorFtp connector
Ftp connector
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
 
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
3.2\9 SSIS 2008R2_Training - ControlFlow Tasks
 
File Connector
File ConnectorFile Connector
File Connector
 
File connector
File connectorFile connector
File connector
 
5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics5\9 SSIS 2008R2_Training - DataFlow Basics
5\9 SSIS 2008R2_Training - DataFlow Basics
 
Set path
Set pathSet path
Set path
 
Apache lb
Apache lbApache lb
Apache lb
 
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
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Sql server
Sql serverSql server
Sql server
 
Jdbc
JdbcJdbc
Jdbc
 
Graduate Project Summary
Graduate Project SummaryGraduate Project Summary
Graduate Project Summary
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
 
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
 
3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks
 

Similar to Translation from csv to xml

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
 
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
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's GuideKeyur Shah
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake TutorialFu Haiping
 
Gstreamer plugin devpt_1
Gstreamer plugin devpt_1Gstreamer plugin devpt_1
Gstreamer plugin devpt_1shiv_nj
 
Oracle RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.Puneet Kala
 
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docxCommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docxmonicafrancis71118
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migrationAmit Sharma
 
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
 
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
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalystsvilen.ivanov
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfRahulRoy130127
 

Similar to Translation from csv to xml (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
 
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
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 
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 RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.
 
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docxCommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 
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?
 
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
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdf
 
GradleFX
GradleFXGradleFX
GradleFX
 

More from Nagarjuna reddy

Webapplicationwithmule by nagarjuanreddy
Webapplicationwithmule by nagarjuanreddyWebapplicationwithmule by nagarjuanreddy
Webapplicationwithmule by nagarjuanreddyNagarjuna reddy
 
Muleexpressiontransformer by nagarjuanreddy
Muleexpressiontransformer by nagarjuanreddyMuleexpressiontransformer by nagarjuanreddy
Muleexpressiontransformer by nagarjuanreddyNagarjuna reddy
 
Iot and mulesoft nagarjuna reddy
Iot and mulesoft nagarjuna reddyIot and mulesoft nagarjuna reddy
Iot and mulesoft nagarjuna reddyNagarjuna reddy
 
Introductiontocloudhubwithmulesoft by nagarjunareddy
Introductiontocloudhubwithmulesoft by nagarjunareddyIntroductiontocloudhubwithmulesoft by nagarjunareddy
Introductiontocloudhubwithmulesoft by nagarjunareddyNagarjuna reddy
 

More from Nagarjuna reddy (6)

Dataweave by nagarjuna
Dataweave  by nagarjunaDataweave  by nagarjuna
Dataweave by nagarjuna
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
 
Webapplicationwithmule by nagarjuanreddy
Webapplicationwithmule by nagarjuanreddyWebapplicationwithmule by nagarjuanreddy
Webapplicationwithmule by nagarjuanreddy
 
Muleexpressiontransformer by nagarjuanreddy
Muleexpressiontransformer by nagarjuanreddyMuleexpressiontransformer by nagarjuanreddy
Muleexpressiontransformer by nagarjuanreddy
 
Iot and mulesoft nagarjuna reddy
Iot and mulesoft nagarjuna reddyIot and mulesoft nagarjuna reddy
Iot and mulesoft nagarjuna reddy
 
Introductiontocloudhubwithmulesoft by nagarjunareddy
Introductiontocloudhubwithmulesoft by nagarjunareddyIntroductiontocloudhubwithmulesoft by nagarjunareddy
Introductiontocloudhubwithmulesoft by nagarjunareddy
 

Recently uploaded

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 

Recently uploaded (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Translation from csv to xml

  • 1. CSV to XML transformation in Mule BY NAGARJUNA REDDY
  • 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:Usersantonio.pellegrinoAnypointStudioworkspacetestcsvtox mlsrctestresourcesinput Move to Directory – C:MuleStudioFileOutbound g properties with specified values:
  • 4. Move to Directory – C:Usersantonio.pellegrinoAnypointStudioworkspacetestcsvtox mlsrctestresourcesoutput 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:Usersantonio.pellegrinoAnypointStu dioworkspacetestcsvtoxmlsrctestresourcesoutput originalDirectory=C:Usersantonio.pellegrinoAnypointStud ioworkspacetestcsvtoxm INBOUND scoped properties: MULE_ORIGINATING_ENDPOINT=endpoint..C.Users.antonio .pellegrino.AnypointStudio.workspace.testcsvtoxml.src.test.r esources.input directory=C:Usersantonio.pellegrinoAnypointStudiowork spacetestcsvtoxmlsrctestresourcesinputlsrctestresou rcesinput 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