Created 12-29-2016 05:07 PM
I have an XML file which I send to an EvaluateXPath processor. The destination of the EvaluateXPath is flowfile-attribute, and it has one user-defined property with the XPath. I can see that that the attribute has the correct value. Now I would like to write the contents of this attribute to a file on the file system. Does anyone know how to do this?
,
Created 12-29-2016 05:19 PM
Hi Karri,
The simplest way to do it to convert your attributes to json and then store it. you can use AttributesToJSON processor:
Thanks,
Jobin
Created 12-29-2016 05:19 PM
Hi Karri,
The simplest way to do it to convert your attributes to json and then store it. you can use AttributesToJSON processor:
Thanks,
Jobin
Created 12-29-2016 05:28 PM
I don't agree with this answer. All AttributesToJSON would do is wrap the attribute in a JSON object and either put it to another attribute or replace the content. If the user is OK with replacing the content then EvaluateXPath with a destination of "flowfile-content" would be the best. Also it ignores the core question, how to put the value generated by EvaluateXPath to disk.
Created on 12-29-2016 07:56 PM - edited 08-19-2019 05:03 AM
Agreed. But Does EvaluateXPath --> save to flowFile Content give you an option at all to deal with original incoming file? Something like below would do both i guess.
EvaluateXpath(Set to Attributes) [match]--> PutFile/DoSomethingElse
EvaluateXpath(Set to Attributes) [match]--> AttributesToJSON-->PutFIle(AttributesAsContent)
Any suggestion/better way to make it better?
Created 08-16-2017 07:59 PM
how do you get the AttributesAsContent in the PutFile processor?
Created 12-29-2016 08:14 PM
Thanks. I got this to work using the AttributesToJSON processor.
Created 12-29-2016 05:19 PM
It would be much easier if you could set the Destination of EvaluateXPath to "flowfile-content". Are you able to do that? If so, do that and then you can do "PutFile" to write the content of the FlowFile to the FileSystem.
Created 04-26-2019 12:00 PM
You can use replacetext processor and in place of replacement use the attribute name you want to have in your flow file.
One thing you must keep in mind that attributes are stored in memory.