One Star

Talend Data Mapper - THMap Include CDATA to XML File

Hi everyone,
I created a mapping with tHMap component for create an XML file from a JSON file.
My XML file is correctly generated but I don't know how to add the CDATA ("<!]>") in some tags. I tried to add a constant(function) in my Map in left/rigth data but Talend replaces the character "<" by "&gt;"
Also, I tried to add CDATA in the initiator/terminator but visibly it only works for the flat files.
How do I add this CDATA to my fields?
Thank's all for your help !
3 REPLIES
One Star

Re: Talend Data Mapper - THMap Include CDATA to XML File

Hi,
I'm afraid there is nothing planned for it in TDM but you should open a case (I would be interested in the answer).
I can suggest a workaround with a tReplace just after your tHmap:

Regards.
Eric
One Star

Re: Talend Data Mapper - THMap Include CDATA to XML File

Hi Eric and thank's for your reply,
The problem is with the "Constant" function in the mapping.
There are others character as "&" -> "&amp;"
I have to build urls with this character, it's strange that it is not possible. If I have to do post mapping replacements on millions of lines, the performance will be declining.
Someone would have another solution?
Thank's!
One Star

Re: Talend Data Mapper - THMap Include CDATA to XML File

The problem is corrected. I created my XML documents without the CDATA but with the correct encode.
Thank's.