XML is a complex format as it is a tree structure, but with a XSD it is possible to safely convert the XML file.
But XSD files also supports various formats with makes it a bit more complicated.
Any how I wrote a few articles about this topic a few weeks ago and also published source code for doing the conversion.
Here is a few direct links that might be useful for you.
XML2CSV git repo nifi-xml
XML2CSV article XML to tables (xml2csv) with NiFi and Groovy Part 2 of 2
If you also is interested in avro forma have a look at this
XML2Avro git repo xml2avro
XML2Avro article XML2Avro NiFi processor