on 09-08-2011 10:44 AM
Hi All,
Can any one suggest me how to remove DOCTYPE from incomming message..
Thanks,
Madhu
Hi Madhu,
Removing <!DOCTYPE needs to devlop the JAVA Adapter Module / JAVA Mapping..
Best Regards,
Naga.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Madhu,
Please find the below java code. change as per your requirement.
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
public class RemoveDocMap implements StreamTransformation{
/**
@param args
*/
private Map param = null;
public void setParameter(Map param)
{
this.param = param;
}
public void execute(InputStream in, OutputStream out)
{
try
{
OutputStream temp = new ByteArrayOutputStream(1024);
byte[] buffer = new byte[1024];
for (int read = in.read(buffer); read > 0; read = in.read(buffer))
temp.write(buffer, 0, read);
String payload = temp.toString();
int ind1 = payload.indexOf("<!DOCTYPE ");
if(ind1 > 0 && (payload.indexOf("<!DOCTYPE XXXXXXXX SYSTEM \"YYYYYYYYYY.dtd\">") >1))
{
int ind2 = payload.indexOf(".dtd\">" )+6;
String sub = payload.substring(ind1,ind2);
payload = payload.replaceAll(sub, "");
}
else if(payload.indexOf("<!DOCTYPE XXXXXXXX >")>1){
payload = payload.replaceAll("<!DOCTYPE XXXXXXXX >", "");
}
out.write(payload.getBytes());
}
catch(Exception e){
}
}
}
Regards,
Naga.
In addition to above suggestions, You can try using XSLT mapping to remove DOCTYPE too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.