Back Forum Reply New

Flatten XML to csv file

Hi,

I am trying to use SpringBatch to flatten an XML file to a csv file. One XML record will result in multiple lines in a csv file so, essentially, I am trying to flatten the hierarchical data structure.

I have read numerous threads and have seen comments made with reference to detailed documentation about this scenario but for the life of me I can not find this scenario detailed anywhere in the documentation. It seems like a trivial request so I'm sure it is there but I can not see it. Can someone please point me to the correct document I need to read to explain how to implement this requirement OR could someone post a simple example.

I have implemented the flattening of the xml based on a fragment root using quot;org..batch.item.xml.StaxEventItemR  eaderquot;
and setting the quot;fragmentRootElementNamequot; but I can then not access elements that are outside the fragmentRootElement. I guess my issue is taht I'm struggling with the nested data set. Any help would be much appreciated.

Thanks in advance.

Maybe you need to describe your input and output data in a bit more detail?  From what I can tell it sounds like you might need to take a StaxExentItemReader and wrap it in a custom reader that pumps out subelements of the individual fragments.  Does that make sense?
¥
Back Forum Reply New