Convert CSV To XML Online



How to convert CSV text files to XML documents?

How CSV data is converted to XML format?

A CSV file consists of any number of records (or lines), separated by line breakers; each record consists of fields, separated by commas. Ideally, all records have an identical sequence of fields.

A CSV record is converted to an XML element and its fields can be converted to attributes of the element or child elements of it, depends on how the user wants. Here is an example of how a field in CSV record is converted to XML:

converted to an attribute:

<row name="John Doe"></row>

converted to a child element:

<row> <name>John Doe </name></row>

Return to the page top

How to prepare CSV files?

You can use a spreadsheet program like Google Spreadsheets or Microsoft Excel to create and edit CSV files. You can include header fields (for example: name, email address, etc.) in the first record of the CSV file. XmlGrid has an option to use the field values of the first line in the CSV file as the element or attribute names. If your CSV file does not provide field headers, XmlGrid will create default field names for you. You can change the default field names after the CSV data is loaded. The following is a sample CSV file:

Key Words,Page Index CSV,2 comma separated values,1 XML document,3 attribute,5 schema,7 element,6 parser, 15 CSV to XML converter,21 XML to CSV converter,31

Return to the page top

How to load CSV data?

You can copy and paste the CSV data into the input box and click the Submit button, or click the Open File button to select a file from your file system.

Return to the page top

How to change options?

To change the default options, simply click on the Options button. You will see the availble options, select the option desired.

Return to the page top

How to execute conversion?

To change the default options, simply click on the Options button. You will see the availble options, select the option desired.

Return to the page top

How to re-load CSV file from casched data?

After your CSV data is loaded, a copy of it is casched in your browser. You can always re-load it by clicking the icon.

Return to the page top

How to convert date format?

The standard XML Date element has the format "YYYY-MM-DD" where:

  • YYYY indicates the year
  • MM indicates the month
  • DD indicates the day.
If your file contains date data in other format your converted XML file will not pass the validation. You can click the Options command button to specify a desired date format conversion. You need to specify the element name for the field that contains the date data.