Skip to Content
0

remove & from xml in HCI using filters or groovy or xslt

Nov 29, 2016 at 07:14 AM

471

avatar image

Hi,

We are getting & in some of the field in XML from Success Factors in HCI but we are getting parsing error as & is a special character for XML and it has meaning in XML.

Can anyone please let me know if we can replace '&' with 'and' in XML using filters or XSLT or Groovy.

I have tried to parse XML using XSLT and Groovy but i am gettin parsing exception. Can we remove '&' using filters. Can anyone help me with groovy or xslt also if any is there to solve this issue.

Regards,

Aman Raj

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Sriprasad Shivaram Bhat Nov 29, 2016 at 10:03 AM
0

Hello Aman,

Below code works.

import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

def Message processData(Message message)

{

//Body

def body_xml= message.getBody(java.lang.String);

def input_xml=body_xml.replaceAll("&","and");

message.setBody(input_xml);

return message;

}

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded