Use tFileInputXML for reading ../process/<job>.item xml file?

Four Stars

Use tFileInputXML for reading ../process/<job>.item xml file?

Hi,
I'm trying to use the new tFileInputXML component to read the <job>.item xml-file. So I can put the content of my transformation in database tables.
Can someone give me a short description how to use the tFileInputXML?

Accepted Solutions
Employee

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

Can someone give me a short description how to use the tFileInputXML?

Sure :-) Let me give you an example.
My XML data is the following:
<?xml version="1.0" encoding="UTF-8"?>
<areas>
<area city="Paris">
<street district="2eme arrondissement">Rue de la Paix</street>
<street district="8eme arrondissement">Champs Elysees</street>
</area>
<area city="New York City">
<street district="Manhattan">Madison avenue</street>
<street district="Brooklyn">Washington heights</street>
</area>
</areas>

1. create a new job with a tFileInputXML (tFIX) and a tLogRow.
2. link the 2 components with a "row > main" link
3. edit the schema of the tFIX, add 3 columns: name, district, city
4. set the filename of the tFIX
5. set the "Loop XPath query" to '/areas/area/street'
6. set the "Mapping column/XPath query" as follows:
name      '.'
district '@district'
city '../@city'

7. run the job (F6), the output is:
Rue de la Paix|2eme arrondissement|Paris
Champs Elysees|8eme arrondissement|Paris
Madison avenue|Manhattan|New York City
Washington heights|Brooklyn|New York City
Employee

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

I'm trying to use the new tFileInputXML component to read the <job>.item xml-file
...
Are the schemas (XSD) published some where?

Hi,
We use an XML serialisation provided by Ecore and based on XMI (XML Metadata Interchange) v2 standard. XMI is an OMG standard for XML Serialization of MOF. Please see http://www.omg.org/XMI for more information about this XML standard.
MOF (Meta-Object Facility http://www.omg.org/mof/) is a subset of UML (class modeling concept) and is very close to Ecore.
You can find the xsd on <TOSDirectory>/plugins/org.talend.model_1.1.0.M3_r1021/model
/resource/org.talend.model/model/TalendFile.xsd


Lots of interesting stuffs are in this directory. For example, the model (ecore), please see the ecore model on <TOSDirectory>/plugins/org.talend.model_1.1.0.M3_r1021/model
/resource/org.talend.model/model/TalendFile.ecore
XMI, MOF, UML, GMF, EMF, Ecore... are concepts used for the Talend MDA (Model Driven Architecture).

All Replies
Employee

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

Can someone give me a short description how to use the tFileInputXML?

Sure :-) Let me give you an example.
My XML data is the following:
<?xml version="1.0" encoding="UTF-8"?>
<areas>
<area city="Paris">
<street district="2eme arrondissement">Rue de la Paix</street>
<street district="8eme arrondissement">Champs Elysees</street>
</area>
<area city="New York City">
<street district="Manhattan">Madison avenue</street>
<street district="Brooklyn">Washington heights</street>
</area>
</areas>

1. create a new job with a tFileInputXML (tFIX) and a tLogRow.
2. link the 2 components with a "row > main" link
3. edit the schema of the tFIX, add 3 columns: name, district, city
4. set the filename of the tFIX
5. set the "Loop XPath query" to '/areas/area/street'
6. set the "Mapping column/XPath query" as follows:
name      '.'
district '@district'
city '../@city'

7. run the job (F6), the output is:
Rue de la Paix|2eme arrondissement|Paris
Champs Elysees|8eme arrondissement|Paris
Madison avenue|Manhattan|New York City
Washington heights|Brooklyn|New York City
Four Stars

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

Thanks for the example. I'll try it.
Are the schemas (XSD) published some where?
Employee

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

I'm trying to use the new tFileInputXML component to read the <job>.item xml-file
...
Are the schemas (XSD) published some where?

Hi,
We use an XML serialisation provided by Ecore and based on XMI (XML Metadata Interchange) v2 standard. XMI is an OMG standard for XML Serialization of MOF. Please see http://www.omg.org/XMI for more information about this XML standard.
MOF (Meta-Object Facility http://www.omg.org/mof/) is a subset of UML (class modeling concept) and is very close to Ecore.
You can find the xsd on <TOSDirectory>/plugins/org.talend.model_1.1.0.M3_r1021/model
/resource/org.talend.model/model/TalendFile.xsd


Lots of interesting stuffs are in this directory. For example, the model (ecore), please see the ecore model on <TOSDirectory>/plugins/org.talend.model_1.1.0.M3_r1021/model
/resource/org.talend.model/model/TalendFile.ecore
XMI, MOF, UML, GMF, EMF, Ecore... are concepts used for the Talend MDA (Model Driven Architecture).
Four Stars

Re: Use tFileInputXML for reading ../process/<job>.item xml file?

Hi,
Thanks for the info on the XSD schemas. I've succeeded in reading the XML files with the help of your example.
I want to pull the info in the XML-repository in a PostgreSQL database and see if I can do some lineage reporting over the ETL jobs in Talend.
When I succeed in the lineage stuuf, then I'll post it on the forum.