  |
 | 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.
|