How to convert an csv to xml with headers grouped together?
Summary
csv,grouppingContent
Hi all,
I have a requirement to convert a csv to xml, but need to group the headers together into parent node.
Could anyone guide me how to do that? The default mapper do not support the group function.
This is a generic requirement and following is an example csv:
InvoiceNumber,InvoiceStatus,LineSeq,Item,Total
10001 ,approved ,1,ITM01,10
10001 ,approved ,2,ITM02,10
10002 ,approved ,1,ITM03,30
10002 ,approved ,2,ITM04,40
After transformation, I want to get following xml:
<Invoices>
<Invoice>
<Header>
<InvoiceNumber>10001</InvoiceNumber>
<InvoiceStatus>approved</InvoiceStatus>
<Lines>
<Line>
<LineSeq>1</LineSeq>
<Item>ITM01</Item>
<Total>10</Total>
</Line>
</Line>
<Line>
<LineSeq>2</LineSeq>
<Item>ITM02</Item>
<Total>20</Total>
0