Withdata Software

Convert XML attributes to CSV columns

I see a post How to convert XML into CSV using XSL, the poster has a test XML like this:

<Tester author="Name" id="16384543">
  <insert tableName="sampletable">
    <column name="id" valueNumeric="2"/>
    <column name="name" value="kathy"/>
    <column name="active" valueBoolean="true"/>
    <column name="age" valueNumeric="2"/>
  </insert>
  <insert tableName="sampletable">
    <column name="id" valueNumeric="23"/>
    <column name="name" value="Queen"/>
    <column name="active" valueBoolean="true"/>
    <column name="age" valueNumeric="29"/>
  </insert>
  <insert tableName="sampletable">
    <column name="id" valueNumeric="25"/>
    <column name="name" value="varshan"/>
    <column name="active" valueBoolean="false"/>
    <column name="age" valueNumeric="5"/>
  </insert>
</Tester>

He want to convert it to CSV like this:

id,name,active,age
2,kathy,TRUE,2
23,Queen,TRUE,29
25,varshan,FALSE,5

So the XML attributes need to be converted CSV columns. I used Data File Converter, figured out converting this XML, in a minute.

1. Open XML in DataFileConverter, set XML options.

2. Set XML custom columns, map XML attributes to columns.

3. Set CSV options.

4. “Next” and “Next”, convert, get the output CSV file.