AnsweredAssumed Answered

1 CSV row for each XML element

Question asked by rob.banas on May 3, 2016
Latest reply on May 4, 2016 by Adam Arrowsmith

Hello, I'm looking to convert:

<Report_Entry>

  <Employee_ID>0006</Employee_ID>

  <Vacation>

  <Vacation_Balance>197</Vacation_Balance>

  </Vacation>

  <Banked>

  <Banked_Balance>14.25</Banked_Balance>

  </Banked>

  <Effective_Date>2016-05-01-07:00</Effective_Date>

</Report_Entry>

<Report_Entry>

  <Employee_ID>0007</Employee_ID>

  <Vacation>

  <Vacation_Balance>100</Vacation_Balance>

  </Vacation>

  <Banked>

  <Banked_Balance>20</Banked_Balance>

  </Banked>

  <Sick>

  <Sick_Balance>10</Sick_Balance>

  </Sick>

  <Effective_Date>2016-05-01-07:00</Effective_Date>

</ReportEntry>

 

into:

 

0006,Vacation,197,2016-05-01

0006,Banked,14.25,2016-05-01

0006,Sick,0,2016-05-01

0007,Vacation,100,2016-05-01

0007,Banked,20,2016-05-01

0007,Sick,10,2016-05-01

 

I'm stuck as I don't know how to use the node's name ie: <Vacation>...</Vacation> to get its value "Vacation" and how to combine these into 1 file.

Secondly, the source XML does not have a Sick_Balance for employee 0006. The output CSV should therefore contain a line with a balance of 0.

Outcomes