cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on XML file convert to CSV

shavadivu
New Contributor II

i have book.xml file with book.XSD file and trying convert into csv file but book.xml missing some element in the xml file. In CSV file required and present and missing element information should visible with blank value with header.
I have tried xml parser and mapper and xml formatter but not able produce missing element in xml for bk003[],bk004[genre>,]

testxml and XSD.txt (1.8 KB)

6 REPLIES 6

igormicev
Contributor

Hi @shavadivu,

I used your example xml and xsd from your attached file. You can see how the csv is created.
I use XML generator for the XML, then a XML Formatter with the schema definition in order to validate the input xml, and then parsing and splitting.

Take a look into this pipeline:
Convert XML to CSV_2020_11_14.slp (11.8 KB)

/Igor

shavadivu
New Contributor II

Is it possible to add file operations to read the incoming xml file and use xml generated.

It’s almost the same.

Take a look at this pipeline. In both cases, I’m using extra XML formatted and XML parser for the purposes of validating the XSD file.

Convert XML to CSV_2020_11_15.slp (20.7 KB)

/Igor

shavadivu
New Contributor II

Thanks and I have tried with attached example xml with XSD file but CSV formatter failed with data need to flatten output of json parser. but CSV requirement is same.
XML file reading from Folder and XML file some elements May or may not come but If elements come then CSV file should have elements header and value else CSV file should have element header with blank value
BOOKORDER_XSD and XML.txt (4.1 KB)