Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Nifi:How to remove xml tag from xml response data?

avatar

I want to replace <?xml version="1.0" encoding="utf-8"?> tag by <DailyData></DailyDate>

I used to replace text nifi processor with this search value:^<[^>]+>(.*)<\/\w+>$ and I put replace value like this in replace value <DailyData>$1</DailyData> but I got error like this inside xml file:

This page contains the following errors:

error on line 1 at column 4081: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.

what should I change?

1 ACCEPTED SOLUTION

avatar
Master Guru

@sally sally, can you make use of below search property

^<[^>]+>(.*)\<\/\?.*\>$ 

Replacetext Configs:-

40419-replacetext-regex.png

Input:-

<?xml version="1.0" encoding="utf-8"?>abc</?xml version="1.0" encoding="utf-8"?>
Output:-
<DailyData>abc</DailyData>

View solution in original post

1 REPLY 1

avatar
Master Guru

@sally sally, can you make use of below search property

^<[^>]+>(.*)\<\/\?.*\>$ 

Replacetext Configs:-

40419-replacetext-regex.png

Input:-

<?xml version="1.0" encoding="utf-8"?>abc</?xml version="1.0" encoding="utf-8"?>
Output:-
<DailyData>abc</DailyData>