Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

[NiFi] Combine FlowFile Attribute and Content

avatar
Explorer

Im trying to create a xml structure which is required by an external application. The format that they require would be something like this

<root>

<attributeOne></attributeOne>

<attributeTwo></attributeTwo>

<flowfile-content></flowfile-content>

</root>

Im able to get the appropriate structure and the required attributes(passed as Parameters) using TransformXML processor.

However im not sure how to access complete flowfile-content (which is a binary) and append into the structure(inside flowfile-content tag).

1 ACCEPTED SOLUTION

avatar
Super Mentor
@Harry

You should be able to simply use two ReplaceText processors in series to create the XML structure you are looking for:

8566-screen-shot-2016-10-14-at-82207-am.png

First replace text configured to prepend text to the binary content as follows:

8567-screen-shot-2016-10-14-at-82340-am.png

and the second to append text to the resulting content from the above:

8568-screen-shot-2016-10-14-at-82542-am.png

*** Note: if you hold shift key while hitting enter, you will create a new line in the text editor as shown in the above examples. An example of the output from the above would look like this:

8569-screen-shot-2016-10-14-at-82756-am.png

There you have the binary content between <flowfile-content> and </flowfile-content>

Now all you need to do is adjust the specific prepend and append values you need.

Thanks,

Matt

View solution in original post

2 REPLIES 2

avatar
Super Mentor
@Harry

You should be able to simply use two ReplaceText processors in series to create the XML structure you are looking for:

8566-screen-shot-2016-10-14-at-82207-am.png

First replace text configured to prepend text to the binary content as follows:

8567-screen-shot-2016-10-14-at-82340-am.png

and the second to append text to the resulting content from the above:

8568-screen-shot-2016-10-14-at-82542-am.png

*** Note: if you hold shift key while hitting enter, you will create a new line in the text editor as shown in the above examples. An example of the output from the above would look like this:

8569-screen-shot-2016-10-14-at-82756-am.png

There you have the binary content between <flowfile-content> and </flowfile-content>

Now all you need to do is adjust the specific prepend and append values you need.

Thanks,

Matt

avatar
Explorer

@mclark

That certainly worked! Thank you so much.

One additional question related to this, is there any other way for me to access the flowfile-content within the XSLT file which i would use through Transform XML?