One Star

[TOS 3.0.4] problem when importing xml CDATA to mysql

Hi,
I need to import into a mysql database an xml file in which every data, numerical or textual, is inside a CDATA tag, for example:
<product_key>
<!]>
</product_key>
and
<station_libelle>
<!]>
</station_libelle>
I have found no good solution to do this. If the data is numerical, when I create a file xml metadata in the repository and indicate the type as numerical I will get an error at the execution of a basic job using file_xml_input and mysql_output, "wrong type". If I indicate the type as string there is no error but the CDATA is deleted and replaced by spaces and \n, so I need to clean the datas in mysql using trim and replace functions.
Is there a way to do a clean import directly in Talend ?
Thanks in advance for your help
Jérôme
2 REPLIES
Community Manager

Re: [TOS 3.0.4] problem when importing xml CDATA to mysql

Hello
Is there a way to do a clean import directly in Talend ?

Set the data type as string and use the method provided by Talend,
StringHandling.TRIM(String s)
see my screenshot
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [TOS 3.0.4] problem when importing xml CDATA to mysql

Hi,
Thanks a lot for your help.
Best regards.
Jérôme