AnsweredAssumed Answered

Dynamically convert xml to csv

Question asked by rethwikj on Jun 28, 2018
Latest reply on Jul 13, 2018 by rethwikj
Hi,
Did anyone work on a requirement with which we can dynamically convert an XML file to CSV file.
I wanted to convert a file like below:
<Rowset>
<ROW>
<A>Test1</A>
<B>Data1</B>
</ROW>
<ROW>
<C>Test2</C>
<D>Data2</D>
<E>Value2</E>
</ROW>
</Rowset>
to:

Test1,Data1
Test2,Data2,Value2
The process will have to dynamically take the values of the fields within each element within row tag. The catch here is that the element tag can have any name within the Row tag.
Is there anyway of achieving this in the Build itself? Or can you please share the Groovy script for this use case if it is available?

Outcomes