Skip to Content
avatar image
Former Member

udf to replace special charactes with other characters.

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Jun 11, 2015 at 06:57 AM

    Hi Sreekanthreddy,

    Check Raghu Vamseedhar Reddy KadipiReddy blog Not well-formed XML - & issue

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


    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 11, 2015 at 08:12 AM

    Hi Sreekanth,

    Java Mapping: To change the encoding type or replacing special characters.

    Hope this helps,

    thanks and regards,

    Praveen T

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 11, 2015 at 08:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 11, 2015 at 02:40 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 12, 2015 at 10:40 AM

    Hi All

    Thanks for your reply,

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

    Best Regards

    Sreekanth

    Add comment
    10|10000 characters needed characters exceeded