Hi Mahesh,
use a java mapping to remove special characters. below code will replace all the special characters you provide in the check string array with a null value.
public class REPLACESC implements StreamTransformation {
private AbstractTrace trace = null;
private Map param = null;
String inputFileName;
public void setParameter(Map param) {
this.param = param;
if (param == null) {
this.param = new HashMap();
}
}
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
trace.addWarning("JAVA Mapping Start");
/*this block of code will remove all the not allowed special characters from outbound xml*/
try
{
byte b[]=new byte[in.available()];
String encoding="UTF-8";
in.read(b);
String inputXML=new String(b);
String[] check = { "]", "&", "<", ">", """, ",", "#", "\\$", "@", "\\[", "\\)"};
for (int i = 0; i < check.length; i++) {
inputXML=inputXML.replaceAll(check[i],"");
}
out.write(inputXML.getBytes(encoding));
}
catch(Exception e)
{
throw new StreamTransformationException(e.getCause().toString());
}
}
public void transform(TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
}
}
you can also use an excel file to store special characters and do a file lookup if the number of special characters are not fixed. let me know if you want to use this option , i will share the code.