Created 02-14-2019 05:13 AM
i have XML files about 1-2 GB i want it to convert into CSV format using apache nifi.
so that i can process CSV for joining the two csv.
Created 02-14-2019 02:53 PM
Hi @Nitin Damle
You can use the ConvertRecord processor (with XMLReader/CSVRecordSetWriter controller services). I have an article here that shows CSV to XML (with CSVReader/XMLRecordSetWriter controller services), so you just need to do the inverse of that record transformation:
https://community.hortonworks.com/content/kbentry/199310/xml-record-writer-in-apache-nifi-170.html
-Andrew
Created 02-27-2019 09:16 PM
Hi @Nitin Damle
I'm assuming you got the flow working with the sample data and template I provided.
Can you provide an example of the desired csv output you are hoping to achieve from the cm_samples.xml file you provided? That would help me understand your end goal for the flow.
Thanks!
Created 02-28-2019 09:21 AM
Created 02-28-2019 09:14 PM
Thanks for the information Nitin.
It seems like it would make sense to "clean up" your incoming XML using the TransformXML processor (https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.6.0/org.apache...) prior to ConvertRecord since there is data there like the header info that you don't care about for the CSV file. Additionally, could change the tag from `p` to its `name` attribute.
I haven't used the TransformXML processor before (or worked with XSLT files before). Take a look yourself and see if you think it could be a solution for you. I will try it out myself if I get the opportunity.
Created 04-05-2019 09:13 AM
Hi Andrew,
I am not able to convert xml to csv as suggested by you to do the inverse of this. Could you please provide the nifi xml file so that I can upload the template and check.
Created 04-09-2019 04:16 PM
Created 04-23-2019 11:20 AM
Hi Andrew , this works for single xml but I have nested xml. How to convert nested xml to multiple csvs ?
Created 04-29-2019 10:17 AM
@Andrew Lim Is there anything possible for nested xml to multiple csvs ?Attached is the nested xml file ad.xml
Created on 02-20-2019 08:08 AM - edited 08-17-2019 05:06 PM
@Andrew Lim After importing it giving me this error
Created 02-20-2019 08:11 AM
Created 02-23-2019 10:53 AM
You can use this NIFI Groovy processor that converts XML to CSV or AVRO
https://github.com/maxbback/nifi-xml