Support Questions
Find answers, ask questions, and share your expertise

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

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.