I want to create XML files from SQL data with using tAdvancedFileOutputXML.
How to do this when XML has complex type ?
In attachment a sample of XML I have to generate.
Thanks for your feedback and your help !
Solved! Go to Solution.
This doesn't look too complicated and can be done using a tXMLMap component quite easily. The documentation can be found here: https://help.talend.com/reader/MjIZDoU6r0vLbCpGh5GAcg/s8O15oJ~4D78_NSJIRZN8w
The same sort of rules apply to the tAdvancedFileOutputXML component. Take a look here:
Essentially you will need to set a loop in your output. Your "value" element is looped so you will set the "loop" on "values". Your "keyName" attribute will need to be set as an attribute. Other than that, the explanations in the links should suffice.
If you are after building something which is a little more complicated (multiple loops, for example), you will either need to use the DataMapper (only in the Enterprise Edition) or make use of something like this....
In input of tXmlMap, we need to have an XML, no ?
From my side, I get datas from SQL and I want to get:
In Tree Configuration of tAdvancedFileOutputXML (as in attchment), I don't find how to do the link.
You need to change your SQL record of City, Code and Country to be delivered in 3 rows. So, for example, you could return two columns (value and type) and supply it like this....
Value - Type
London - City
LON - Code
UK - Country
Either do that with your SQL query or you can do it with a tNormalize component and following this post : https://www.talendforge.org/forum/viewtopic.php?id=6611
I'm feeling a little bit stupid but I didn't succeed
I simplify my request.
Suppose I have only one index "City" with the value "London" in my database.
I get the couple <"City",London> from the component tMSSQLinput for example.
And with using tAdvancedFileOutputXML, I want to get :
<value keyName="City"> LONDON </value>
I don't understand how to do as you can see in attachment...
Glad you got it working. The more you use Talend, the more you will get used to it and it will become more intuitive :-)
Try Talend Cloud free for 30 days.
Introduction to Talend Open Studio for Data Integration.
Practical steps to developing your data integration strategy.
Create systems and workflow to manage clean data ingestion and data transformation.