Hi David,
As Inaki, told this cannot be fixed using UDF, you need to go for Java mapping as the parsing of characters must happen before the data is converted into XML, while using graphical mapping already the data is converted into XML and hence it is displayed as invalid XML.
My suggestion would be to first download the Hex editor from the below link and paste your source XML and find out what is the Hex code of your special character.
Once you have the hex code, you can use the below Java mapping -
public class SpecailCharacter extends AbstractTransformation{
public void transform(TransformationInput input, TransformationOutput output)
throws StreamTransformationException {
try {
InputStream ins = input.getInputPayload().getInputStream();
InputStreamReader isr = new InputStreamReader(ins);
BufferedReader br = new BufferedReader(isr);
StringBuilder payloadtemp =new StringBuilder();
String payload ="";
String s1;
s1 = br.readLine();
while (s1!= null)
{
String s="";
for(int i=0;i<s1.length();++i)
{
if(s1.charAt(i)!=your special character Hex Code)
s=s+s1.charAt(i);
}
payloadtemp.append(s);
}
payload = payloadtemp.toString();
output.getOutputPayload().getOutputStream().write(payload.getBytes());
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Please let me know if you face any difficulty in this.
Regards,
Nitin