work related

May 20, 2008

XMLizing data

I spent a few hours this morning cleaning up my first stage csv to xml conversion process/application.

I'm using XML::Writer which turns out to be very straight forward and simple. I created and refined a smallish perl app to create the initial xml file from a flat csv file that is dumped nightly.

So with my perl app I can go from this:

200810,09-MAY-2008,15-AUG-2008
200840,16-AUG-2008,27-DEC-2008
200850,28-DEC-2008,07-MAY-2009

To this

<?xml version="1.0" encoding="UTF-8"?>
<cm-data>
  <academic-sessions>
   <academic-session>
    <eid>200810</eid>
    <title>Summer 2008</title>
    <start-date>09/05/2008</start-date>
    <end-date>15/08/2008</end-date>
   </academic-session>
   <academic-session>
    <eid>200840</eid>
    <title>Fall 2008</title>
    <start-date>16/08/2008</start-date>
    <end-date>27/12/2008</end-date>
   </academic-session>
   <academic-session>
    <eid>200850</eid>
    <title>Winter 2008</title>
    <start-date>28/12/2008</start-date>
    <end-date>07/05/2009</end-date>
   </academic-session>
  </academic-sessions>
</cm-data>

This will be something more managable within the CM interface.