How to create Input and Output Xml File Metadata Create a metadata on the Repository to connect to an XML File and describe its Schema

This tutorial shows you how the "XML File" wizard can help you deal with complex file formats.

You can create either Input or Output XML file metadata and you can also create Schemas specific to all your needs. For example, you could define a "home address" schema and another "delivery address" schema both corresponding to the same file.


Prerequisites:
To follow this tutorial, you need to download and extract the exampleFile.zip file available at the bottom of this page in the Download it! section of this tutorial.
Once unzipped, you will get a file named customer.xml, the XML file to use to create the metadata.

Download it!

You want to practice?

Download exampleFile.zip to get the files used for this tutorial.

You can also download tutorialProject.zip containing all the jobs needed to carry out this tutorial.

You can also:
Send it!

Share it!
Next Step: The best method is practice, so keep using Talend Open Studio and take control of your company data!

 


Create a metadata for an XML File


In the Repository on the left of the Talend Open Studio main screen:

Expand the Metadata node.

Right-click on File xml.

In the menu, click Create file xml to open the New Xml File wizard.

Next
  
First we'll see how to create a metadata for an Input XML File, a file providing input data to be processed

Next
  

In the New Xml File wizard:

In the Name field, name the metadata customersInput.

Click Next to continue.

Next
Create a metadata for an Input XML file


Select Input XML and click Next to continue.

Next
From the Linker Source area, select the id column and drag it onto the customer element of the Linker Target area.

A Selection window pops up.
Select the Create as sub-element of target node option and click Ok.

Next

Click Browse... and select the customer.xml file from the wizard.

The Encoding list will be filled in automatically.

A preview of the xml tree displays in the Schema Viewer area.

Click Next.

Next

In the Source Schema area, select the customer node and drag it to the Xpath loop expression table of the Target Schema area.

In the Source area, select @id and CustomerName and drag them to the Fields to extract table of the Target Schema area.

In the Preview area, at the bottom of the wizard, click the Refresh Preview button to display the schema preview.

Click Next.

Next

In the Description of the Schema table, select the Key check box next to the id column.

Click Finish to close the wizard and create the new metadata.

Next
  
Now let's create a metadata for an Output XML file that describes the schema and defines the connection to the XML file in which the data will be written.

Next
  
Create a metadata for an Output XML file

Select Output XML and click Next.

Next

Click Browse... and select the customer.xml file from the wizard.

The Encoding list will be filled in automatically.

A preview of the xml tree displays in the Schema Viewer area.

Click Next.

Next
From the Linker Source area, select the id column and drag it onto the customer element of the Linker Target area.

A Selection window pops up.
Select the Create as sub-element of target node option and click Ok.

Next
Drag the other column elements from the Linker Source to their corresponding elements in the Linker Target table.

Select Create a sub-element of a target node every time the Selection window pops up.

Click Next to continue.

Next
Finalize the metadata by giving a new name ti its schema and adding a comment if necessary.

You can also add, delete or move the rows by using [+], [X] and up and down arrows respectively.

Then click Finish to close the wizard and create the new metadata.

Next

In the Repository on the left:

The customersInput and customersOutput metadata are displayed under the Metadata > File xml node.

  Next Step: The best method is practice, so keep using Talend Open Studio and take control of your company data!

 

    Download it!     Send it!     Share it!

You want to practice?

Download exampleFile.zip to get the files used for this tutorial.

You can also download tutorialProject.zip containing all the jobs needed to carry out this tutorial.

Friends / colleagues may be interested in this tutorial? Send it to them!

You liked this tutorial ? Support it!

[ top ]