Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

replaceSpecialCharForXML Replacing & on escape characters

I have a job that takes in an MySQL input, performs a tmap then produces an xml output file via the advanced xml output plugin (I have selected UTF8 format). I use the replaceSpecialCharForXML function to replace any characters like apostrophe, ampersand, etc into the correct xml format.
My issue is that this replaceSpecialCharForXML function is replacing the apostrophe and then also replacing the ampersand with another xml escape character.
Eg,
Sample data: Mr Jone's
Expected xml output using replaceSpecialCharForXML: Mr Jone's
What is occuring: Mr Jone's
Surely this function is not supposed to replace the & that is the apostrophe escape character?
Any help or advice would be appreciated.
Thanks
Steph
Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hi
This function works well,
tFileInputDeliimited--main--tMap--main--tLogRow
I can see the correct result on the console
Mr Jone's
the problem occurs on tAdvancedFileOutputXML component
tFileInputDeliimited--main--tMap--main--tLogRow--tAdvancedFileOutputXML
If I open the xml file in editor, it displays Mr Jone's, if I open the xml file directly in browser, it displays Mr Jone's.
Anonymous
Not applicable
Author

I don't understand why you escape these special characters, using a tFile(advanced or not)OutputXML should produce a valid XML file and escape them for you.
It seems to me you're doing twice the job and that's why it ends up like this. Furthermore you're using UTF-8 so you shouldn't have the problem I encountered here : https://community.talend.com/t5/Design-and-Development/Encoding-issue-with-tFileOutputXML/td-p/76368