Skip to content

The is a text-based utility, written in Java, which converts a small subset of data from a sample comma-separated value (CSV) format, to ESDS compliant XML, suitable for upload to the ESDS via the bulk data ingestion mechanism.

Notifications You must be signed in to change notification settings

inbloom/csv2xml

Repository files navigation

Sample CSV-to-XML Conversion Tool

The is a text-based utility, written in Java, which converts a small subset of data from a sample comma-separated value (CSV) format, to compliant ESDS XML, suitable for upload to the ESDS via the bulk data ingestion mechanism.

How to build and run the CSV2EDFI Converter

Note: You are expected to have a current version of the Java JDK and Eclipse on your system to compile and run this utility.

  1. Unzip the sli-csv2xml.zip file to your preferred location, skip this step if you forked the repo on Github

  2. Download your preferred Ed-Fi core XML schema and Interchange schema files from http://www.ed-fi.org/technical-documentation/ . Place these in the edfiXsd folder within the project.

  3. At a command prompt, and in the edfiXsd folder, run the following command: xjc -b Ed-Fi-Core.xjb -p org.slc.sli.sample.entities .

  4. Replace all java code in org.slc.sli.sample.entities with the newly generated code from step three.

  5. Update Adapter2.java with the following code.

     //
     // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
     // Any modifications to this file will be lost upon recompilation of the source schema.
     // Generated on: 2012.04.20 at 03:09:04 PM EDT
     //
     package org.slc.sli.sample.entities;
    
     import java.util.Calendar;
     import javax.xml.bind.annotation.adapters.XmlAdapter;
     
     public class Adapter2 extends XmlAdapter<String, Calendar>
     {
     	public Calendar unmarshal(String value) {
     		return (javax.xml.bind.DatatypeConverter.parseDate(value));
     	}
     	public String marshal(Calendar value) {
     		if (value == null) {
     			return null;
     		}
     		return (javax.xml.bind.DatatypeConverter.printDateTime(value).substring(0, 10));
     	}
     }
    
  6. The program will run the default sample data, generating students, parents and student-relationships, in an XML Interchange file if run at this time. In order to run, import the project as a maven project into eclipse. Right click on the CSV2XMLTransformer.java source file and select ‘Run… As Java Application.’

  7. In order to generate different XML files, it is necessary to change the input/output files. That is done in the CSV2XMLTransformer.java source file around lines 78 to 87. The details on how to form the CSV files, as well as some additional information about this utility, are contained in the CSV2XMLTransformer_Supplemental.docx document.

Licensing

CSV2XML is licensed under the Apache License, Version 2.0. See LICENSE-2.0.txt for full license text.

About

The is a text-based utility, written in Java, which converts a small subset of data from a sample comma-separated value (CSV) format, to ESDS compliant XML, suitable for upload to the ESDS via the bulk data ingestion mechanism.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages