SlideShare a Scribd company logo
CSV to XML transformation in Mule
BY
NAGARJUNA REDDY k
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

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
Pramod Singla
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
kunj desai
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
Pooja Talreja
 
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
Pramod Singla
 
Set path
Set pathSet path
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
StrawhatLuffy11
 
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
Dr. Krishna Mohbey
 
Sql server
Sql serverSql server
Sql server
Puja Gupta
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
Vikas Jagtap
 
Jdbc
JdbcJdbc
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
Ranjan Kumar
 
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
Jitendra Bafna
 
File Connector
File ConnectorFile Connector
File Connector
Thang Loi
 
File connector
File connectorFile connector
File connector
Thang Loi
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
kunal vishe
 
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
Pramod Singla
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
akashdprajapati
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
Nagarjuna reddy
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
Mike Willbanks
 
Mule data weave_2
Mule data weave_2Mule data weave_2
Mule data weave_2
kunal vishe
 

What's hot (20)

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
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
 
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
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
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
 
Sql server
Sql serverSql server
Sql server
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Jdbc
JdbcJdbc
Jdbc
 
JDBC Java Database Connectivity
JDBC Java Database ConnectivityJDBC Java Database Connectivity
JDBC Java Database Connectivity
 
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
 
File Connector
File ConnectorFile Connector
File Connector
 
File connector
File connectorFile connector
File connector
 
Mule debugging managing_stack_traces
Mule debugging managing_stack_tracesMule debugging managing_stack_traces
Mule debugging managing_stack_traces
 
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
 
MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
 
Dataweave nagarjuna
Dataweave nagarjunaDataweave nagarjuna
Dataweave nagarjuna
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
Mule data weave_2
Mule data weave_2Mule data weave_2
Mule data weave_2
 

Similar to Transformation from csv to xml

Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxml
Germano Barba
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10
kunal vishe
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
俊 朱
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
Keyur Shah
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
Rajesh 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 webpack
NodeXperts
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
Rich Helton
 
OMG D&C Tutorial
OMG D&C TutorialOMG D&C Tutorial
OMG D&C Tutorial
Johnny Willemsen
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
Fu Haiping
 
Oracle RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.
Puneet Kala
 
Gstreamer plugin devpt_1
Gstreamer plugin devpt_1Gstreamer plugin devpt_1
Gstreamer plugin devpt_1
shiv_nj
 
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docxCommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
monicafrancis71118
 
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
Hitesh Mohapatra
 
Rest web service_with_spring_hateoas
Rest web service_with_spring_hateoasRest web service_with_spring_hateoas
Rest web service_with_spring_hateoas
Zeid Hassan
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
Amit Sharma
 
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
RahulRoy130127
 
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
 
GradleFX
GradleFXGradleFX
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
svilen.ivanov
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
Amit Sharma
 

Similar to Transformation from csv to xml (20)

Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxml
 
Mule data weave_10
Mule data weave_10Mule data weave_10
Mule data weave_10
 
Oaf development-guide
Oaf development-guideOaf development-guide
Oaf development-guide
 
Oracle Endeca Developer's Guide
Oracle Endeca Developer's GuideOracle Endeca Developer's Guide
Oracle Endeca Developer's Guide
 
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
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 
OMG D&C Tutorial
OMG D&C TutorialOMG D&C Tutorial
OMG D&C Tutorial
 
CMake Tutorial
CMake TutorialCMake Tutorial
CMake Tutorial
 
Oracle RI ETL process overview.
Oracle RI ETL process overview.Oracle RI ETL process overview.
Oracle RI ETL process overview.
 
Gstreamer plugin devpt_1
Gstreamer plugin devpt_1Gstreamer plugin devpt_1
Gstreamer plugin devpt_1
 
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docxCommissionCalculationbuildclasses.netbeans_automatic_build.docx
CommissionCalculationbuildclasses.netbeans_automatic_build.docx
 
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
 
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
 
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
 
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?
 
GradleFX
GradleFXGradleFX
GradleFX
 
Web applications with Catalyst
Web applications with CatalystWeb applications with Catalyst
Web applications with Catalyst
 
User and group security migration
User and group security migrationUser and group security migration
User and group security migration
 

Recently uploaded

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 

Recently uploaded (20)

DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 

Transformation from csv to xml

  • 1. CSV to XML transformation in Mule BY NAGARJUNA REDDY k
  • 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