nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Burgess <mattyb...@apache.org>
Subject Re: CSV to XML in NiFi using ScriptedRecordSetWriter
Date Fri, 13 Oct 2017 18:52:19 GMT
Kiran,

Yes we have a unit test that implements a trivial XML ScriptedReader
[1]. Hopefully that can get you the rest of the way, also there's an
inline one [2] that is likely less helpful because it defines the
schema inline, versus using the incoming schema.

Regards,
Matt

[1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/resources/groovy/test_record_reader_xml.groovy
[2] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/resources/groovy/test_record_reader_inline.groovy

On Fri, Oct 13, 2017 at 1:54 PM, Kiran <kiran.bdi@protonmail.com> wrote:
> Matt,
>
> Thanks for the link. With a few minor tweaks that worked great got all my
> CSV files tranformed fine.
>
> I've got a seperate system which goes the other way and has XML deliveries
> and wants to ingest CSV. On the old version of nifi I would have used
> TransformXml and XSLT to achieve this, should I still go down that route or
> can you point me in the direction of a xml Scripted reader example?
>
> Kiran
>
>
>
> -------- Original Message --------
> On 13 Oct 2017, 00:23, Matt Burgess < mattyb149@apache.org> wrote:
>
>
> Kiran,
>
> There is an example of a Groovy script for an XML writer [1] in the
> unit tests for ScriptedRecordSetWriter, this should be a pretty good
> place to get started, but please let us know if you have any questions
> or issues in making it work.
>
> Regards,
> Matt
>
> [1]
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/resources/groovy/test_record_writer_inline.groovy
>
> On Thu, Oct 12, 2017 at 6:55 PM, Kiran wrote:
>> Hello,
>>
>> I have recently upgraded from NiFi 0.7.0 to 1.4.0 and the new version is
>> amazing.
>>
>> I'm trying to use the RecordWriter and RecordReader controller services to
>> convert my input CSV into XML. I have a CSVReader and a
>> ScriptedRecordSetWriter.
>>
>> My CSV is very simple:
>> "Header1","header2"
>> "Value1","value2"
>>
>> Im having a few issues trying to get the ScriptedRecordSetWriter working,
>> can anyone point me to some examples/documentation for writing the script?
>>
>> I'm using groovy to write the script and I've previously used the
>> ExecuteScript processor succesfully but I cant see to get the
>> ScriptedRecordSetWriter working.
>>
>> Thanks
>>
>> Kiran

Mime
View raw message