cancel
Showing results for 
Search instead for 
Did you mean: 

ascii characters removal

Former Member
0 Kudos

hii experts,

this is shreya.i have a payload from where i need to remove the special characters searching them through their ascii codes.

Please suggest a solution to my problem.

Accepted Solutions (0)

Answers (2)

Answers (2)

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Shreyasen Gupta,

I think this issue not related to character encoding (ascii or UTF-8). It is related to well formed XML.

Please note:- quote ("), apostrophe ('), ampersand (&), less than (<), greater than (>) are special characters in XML. They should not be present in data.

http://www.w3.org/TR/REC-xml/ The ampersand character (&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively.

Escape characters u201C &quot ; , u2018 &apos ; , & amp ; , < &lt ; , > &gt ;

Not Well formed XML:

<Name>Raghuu2019s</Name>   <Name> Raghu & Vamsee </Name>

Well formed XML:

<Name>Raghu&apos;s</Name>   <Name>Raghu &amp; Vamsee</Name>

It is very difficult (if not impossible) to escape & and <, to make XML 100 % well formed in PI. Escaping should be done at source side, when XML is getting generated.

If you have no control on sender side, then find out in which element of XML these characters are coming and then write a Java mapping to escape the special characters. This solution will not fix the issue to 100% accuracy, but I feel it is the best available solution. Note, Graphical and XML mapping cannot take Not Well formed XML as input, so they cannot be used.

Regards,

Raghu_Vamsee

stefan_grube
Active Contributor
0 Kudos

Why has your payload invalid characters?

Fix the issue in sender system.

Former Member
0 Kudos

hii,

My payload contains some special characters which can not be mend at the sender side, and they have to be delivered as it is to the reciver, but integration engine can not handle the special characters so i need to replace them with something and convert the entire payload to the integration engine specific format.

Again at the reciver side it has to go back in the same format in which receiver has sent it.

shreya

stefan_grube
Active Contributor
0 Kudos

Is the incoming payload XML? then it must comply XML standard.

Do you want to have a different structure at receiver?

If not, just forward it without any mapping.

Former Member
0 Kudos

no the incoming payload is not XML.

It is an idoc.

Cant forward it without any transformation becuase integration engine does not support the special character "&" which might be present in my payload.

Shreya

stefan_grube
Active Contributor
0 Kudos

> no the incoming payload is not XML.

> It is an idoc.

So it is a idoc flat file?

> Cant forward it without any transformation becuase integration engine does not support the special character "&" which might be present in my payload.

When you do no mapping, then Integration Engine will not care about the content.

If your incoming payload is not XML, then you cannot do mapping anyway.

Edited by: Stefan Grube on Jan 4, 2011 10:18 AM