Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

remove special characters from xml text node using nifi

Highlighted

remove special characters from xml text node using nifi

New Contributor

Hi, i want to remove special characters like \,",' from a text node in the xml. May i know how to do this with replacetext processor.


xml path is something like this and i need to strip special character from the comment text.

<Producer>

<Individual>

<BusinessProcesses>

<BusinessProcess>

<Comment>| 8/2/10 project. code needs to be in TX. SM |&#xA;

"8/2/10" \ Kaplan study materials ordered . SM |</Comment>

</BusinessProcess>

</BusinessProcesses>

</Individual>

</Producer>

1 REPLY 1

Re: remove special characters from xml text node using nifi

Super Guru

@Lokesh Garlapati

Configure ReplaceText processor as shown below

108905-screen-shot-2019-05-23-at-111429-pm.png

In search value we are looking for [\"|\\|'] any special characters in ",',\ and replacing with empty string.

Java Regex explanation:

[\"|\\|'] -> matches any character in ",',\ and | is act as or operator.

**Note: you need to change the Maximum Buffer size as per your flowfile size.