12
Example transformation from CSV to XML CREATE BY GIUSEPPE FIORE MULESOFT TRAINING

Example transformation from CSV to XML

Embed Size (px)

Citation preview

Page 1: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Example transformation from CSV to XML

MULESOFT TRAINING

Page 2: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Through this example you will be ablo to:

1) Using component «file connector» to read and to write file CSV

2) Using DataMapper to convert CSV to Maps3) Using converter component «Maps To XML»4) Using component «Logger»5) Build and Debug Application with AnyPointStudio

Page 3: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Using component «File Connector» to read and to write file CSVThe File connector allows your Mule application to exchange files with a file system. You can implement the File connector as an inbound endpoint (such as, a message source), or as an outbound endpoint. This endpoint implements a one-way exchange pattern only.

You can read this article for more information about file connector: https://docs.mulesoft.com/mule-user-guide/v/3.7/file-connector

Page 4: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Using DataMapper to convert CSV to MapsDataMapper is a Mule transformer that delivers simple, yet powerful, visual design of complex data transformations for use in Mule flows, including:

Extraction and loading of flat and structured data formats Filtering, extraction and transformation of input data using XPath and powerful scripting Augmenting data with input parameters and lookups from other data sources Live design-time previews of transformation results High-performance, scalable data mapping operations

Page 5: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Using converter component «Maps To XML»

The Component «Maps To XML» convert a List of object to XML type.

In this case not required configuration.

Page 6: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Using Logger

Use the Logger to log messages such as error messages, status notifications, or exceptions.

Page 7: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

Insert a new breakpoint on component «DataMapper Transformer»

Page 8: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

Create a new debug configuration like show in this picture:

… after you can click on button «Debug»

Page 9: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

Copy a new file csv into folder «/input». The after copy the debug will be started:

Click F6 for the next processor ….

Page 10: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

Click F6 for the next processor ….

Page 11: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

Click F6 for the next processor ….

Page 12: Example transformation from CSV to XML

CREATE BY GIUSEPPE FIORE

Build and Debug Application with AnyPointStudio

you can show the result on console: