One Star

Fetch value from database and insert into XML file

hello ,

talend.PNGtt.PNG

I want to add data to the "ArrayOfString" tag when setting name = "Communes" and setting name = "ETAT".

for this i defined "ArrayOfString"  element Group and "String" element loop.

the problem that I always add the data in the first ArrayOfString tag or the setting name = "Groups".

 

the structure of the file xml is : 

 

<configuration>
<applicationSettings>
<AlerteCIS.My.MySettings>

<setting name="a" serializeAs="String">
<value>a</value>
</setting>
<setting name="b" serializeAs="String">
<value>b</value>
</setting>
<setting name="c" serializeAs="String">
<value>c</value>
</setting>


<setting name="Groupes" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>1</string>
<string>2</string>
<string>3</string>
</ArrayOfString>
</value>
</setting>

<setting name="Natures" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>a</string>
<string>b</string>
<string>c</string>
</ArrayOfString>
</value>
</setting>
<setting name="Communes" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>a</string>
<string>b</string>
<string>c</string>
</ArrayOfString>
</value>
</setting>
<setting name="ETAT" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>a</string>
<string>b</string>
<string>c</string>
</ArrayOfString>
</value>
</setting>
</AlerteCIS.My.MySettings>
</applicationSettings>
</configuration>

1 REPLY
Community Manager

Re: Fetch value from database and insert into XML file

Hi
Your input data should contains setting name value so that the string will be inserted to the right group. For example:
Add a new column called setting_name, and set its value as "Communes" on tMap before tAdvancedFileOutputXML. Map this column to @name element on tAdvancedFileOutputXML.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business