cancel
Showing results for 
Search instead for 
Did you mean: 

udf to replace special charactes with other characters.

0 Kudos

Hi Experts,

I am new to java udfs, can you please provide me the java code for following scenario.

I need to replace below special characters with specified string.

<  &lt;

>  &gt;

&  &amp;

'    &apos;

"   &quot;

example: input value: salary < 100

               output value: salary &lt; 100

Note: Please let me know if it is possible in graphical mapping.

Thanks in Advance,

Sree

Accepted Solutions (0)

Answers (5)

Answers (5)

0 Kudos

Hi All

Thanks for your reply,

We have done the scenario in Graphical mapping only , thanks alot guys

Best Regards

Sreekanth

0 Kudos

Hi  guys

In the graphical mapping its cant work all test cases so now  again we are implemented through Java Code only.

Thanks

Sreekanth

Former Member
0 Kudos

Hi,

You can achieve the same through XSLT mapping, since as far as I know, &lt, &gt are used in XSLT mapping. Please find the below link for the same:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd...

Regards,

Souvik

stefan_grube
Active Contributor
0 Kudos

example: input value: salary < 100

               output value: salary &lt; 100

It is not possible to do this in a UDF and it makes no sense to do it in mapping anyway.

If your payload contains a < charater, then you should solve the issue at sender side. Insist on valid XML.

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Sreekanth,

The same issue has discussed in earlier thread discussions also. Please find below the information.

Please check this and let us know if you get struck anywhere.

Regards

Vishnu

praveen_sutra
Active Contributor
0 Kudos

Hi Sreekanth,

Hope this helps,

thanks and regards,

Praveen T

iaki_vila
Active Contributor
0 Kudos

Hi Sreekanthreddy,

Check Raghu Vamseedhar Reddy KadipiReddy blog

You only need to add  inputContent = inputContent.replaceAll("&", "&amp;");  with all the characters that you want to change.


Regards.