How to format an XML string

Talend Open Studio for ESB User Guide

EnrichVersion
6.4
EnrichProdName
Talend Open Studio for ESB
task
Design andĀ Development
EnrichPlatform
Talend Studio

It is easy to run the replaceSpecialCharForXML routine along with a tJava component, to format a string for XML:

System.out.printIn(TalendString.replaceSpecialCharForXML("Thelma & Louise"));

In this example, the "&" character is replaced in order to make the string XML compatible: