©1995–2012, Fairlight Consulting
PayPal: View Cart
CSV to XML Documentation


Released: 01/02/08

Program Summary

Using the Fairlight CSV to XML Converter, you can generate XML data from a simple two-field-per-line CSV format, including on-the-fly Base64 file encoding and encapsulation. This is an excellent companion for programs that don't inherently support XML exporting.

This command-line based program may be used directly, or used in automated systems. It is possible to build a GUI or web-based wrapper around the program (see the demo page below for a live example of such a creature).

Supported Platforms

Currently supported platforms are:

Required Modules

The program requires the following modules be installed for Perl on any non-Windows platform:

The self-extracting executable version for Windows meets all of these requirements for you. That version does not require perl be installed at all.

Demo Versions

This program can be tested via a web front-end designed specifically for this purpose.

Click here to demo!



Run the Win32 installer.

Other Platforms

Unpack the compressed tar or zip archive into any directory you choose. A subdirectory named csv2xml-install will be created, and all program and documentation files are present within this subdirectory. You may relocate the program from this directory to elsewhere.

Edit the first line of the program file to reflect the location of your perl binary!


csv2xml [options] csv_filename


This option denotes to what file the XML output is written.

This option lets you change the comma separator to some other arbitrary character (or characters).

This option lets you change the double-quote character to some other arbitrary character (or characters). An example would be a single-quote.

This option removes all non-value whitespace and newlines from the XML output, creating one solid chunk of XML rather than a nicely formatted version.

This specifies the path to which any decoded Base64 files will be saved.

This option is for internal csv2xml development, and/or bug report traces. This option should not normally be used unless you enjoy creating large files for no reason.

This option returns the program version information.

This option returns the program changelog information.

This option returns the program help (a briefer summary of the options) in a self-paging fashion.

CSV Format

The format for the CSV this file uses is very specific. Please adhere to the rules that follow.

Anywhere a non-value element (a "container" element that has no child elements should begin, the following line should be output:


Anywhere a non-value element (see above) should close, the following line should be output:


Anywhere attributes start for an element, the following line should be output immediately after either 1) the __FLT_TAG_OPEN__ line that opened the non-value element, or 2) immediately after the line that gives a value-containing element in the case of a plain data element(the last line type depicted below):


Anywhere attributes end for an element, the following line should be output:


All other lines representing elements with a value should be in the format:


The following is an example of a CSV that would generate valid output:

Note how the attributes for container fields follow tag open lines, and the attributes for the plain data element (newfile) both follow their respective lines.

You can copy the text from the textarea above, save it to a local file, and upload it into the demonstration to see the resultant XML, if you wish.

Auto-Embedding/Encoding Files with Base64

If you prefix an element's value with B64: in the form of:


...then the whole contents of the indicated file will automatically be encoded in Base64 and placed in the field.

Error Detection

All errors will be written to standard output. This means that if the program prints anything to what would be the terminal (or the console window in Windows), there was an error. Redirection of output to a file in any operating system will let you see if there was an error. The error will be contained in the file. If the program was 100% successful, there will be no output of this type, and any redirection destination file would be zero bytes long. If you use this method to catch errors in an automated system, check the file size after using a redirect with the csv2xml command. If the file is larger than zero bytes, check the file for the exact error.


v01.00.00 - 01/02/08

Original Release.

v01.00.01 - 01/02/08

Control-M fix for cross-platform file use.

Copyright, License, Warranty, and Payment

This software remains the property of Fairlight Consulting, and license to use the program is sold to users. Fairlight CSV to XML Converter is licensed at a cost of $495.00 USD per server on which it is installed. Each license fee entitles you to use the program on one server, in any role you require.

Upon receipt of payment for a license, program will be delivered to the licensee via email at the email address associated with the PayPal payment.

Upgrades for the product are free when moving to new minor and bugfix point-release versions. Major version upgrades will be paid upgrades. Fairlight Consulting reserves the right to change this policy in the future, with no prior warning.

There is no warranty for this software. This software is offered "AS-IS" and without warranties as to performance or merchantability or any other warranties, whether expressed or implied.

Good computing practice dictates that any program should be thoroughly tested with non-critical data before deploying it for production. The user assumes the entire risk of using the program. In no event shall Fairlight Consulting be held liable for loss of data, failure of performance, or any other damages, be they real or perceived.

PayPal: Add Fairlight CSV to XML Converter to cart