View All Blog Posts

Converting CSV file to XML

Quite often you need a quick and simple way to convert data in a CSV File format into a simple XML document. Typically you would probably write a small script or use a software application and get involved with schema’s etc. Data Synchronisation Studio makes the whole process quick and painless.

Simply open Data Sync and Connect Data Source A to your source CSV File.


You can preview the Data to check that it is loading correctly.


This Dataset does not contain a Unique ID key column so were going to use a Feature in Data Sync called Calculated Columns to decorate the data with new Data.

Click the Fx button on the Data Source A Toolbar to add a new Function and enter the Name and Function like this.

Calculated Columns

NEXTINT() function returns a number for each row incrementing the value by 1 each time it is called. We can now adjust the schema Map how we want the target XML to be created, setting Data Types here will ensure the XML Schema contains the correct data type.


Next to create the XML Target Data Source go to the Tools menu and select “Create XML Dataset” this will ask for a Filename and create an Empty XML Document.

XML Target

Press Compare A->B and Data Sync will work out the rows to ADD/UPDATE/DELETE from the XML document, then press Synchronise and Start to actually copy the data to the XML File.


Once the Synchronisation process has completed your then left with an XML Document containing your data.


Now that this is all setup and configured, you can easily save this as a project and either schedule it to run automatically or just run it ad-hoc when you need it.

| Monday, October 14, 2013 |