Convert CSV to XML
Turn CSV files into XML. Objects become elements inside one root element and every value becomes text, with characters a tag name cannot hold turned into underscores.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop CSV files on the dialor turn it to pick what to do
Your table as one XML file.Each row becomes an element inside a single root element. Every value is written as text.
What you get
One XML file. The rows of your CSV sit inside one root element, and each value becomes an element holding text. XML has no separate number or date types here, so every value is text.
Characters that a tag name cannot hold are turned into underscores. This matters when a column heading has spaces or other odd characters, because the heading becomes the element name.
How special keys are handled
A key that starts with @ becomes an attribute instead of an element. A key named #text becomes the element's own text. Where an attribute would hold a list or an object, it is written as JSON text.
A list repeats its element, once for each item. An empty list therefore disappears from the output, and a list of lists is flattened into one run of repeated elements.
Choosing the delimiter
The delimiter is the character between fields. When you leave it out, it is guessed from the rows. Set Delimiter to comma, semicolon, tab or pipe if the guess is wrong.
Spreadsheets in many European locales use semicolons, so a file exported from one of them is a case where you may want to set it yourself.
To go the other way, use XML to CSV.
CSV and XML.What each format is, and the options this conversion takes.
- 01 · delimiter
Delimiter
The character between fields. It is guessed from the rows when left out. Spreadsheets in many European locales use semicolons.
commaA comma.semicolonA semicolon.tabA tab.pipeA vertical bar.
The formats
CSV
Rows of comma-separated values. The plainest way to move a table between programs.
- Extensions
- .csv
- MIME type
- text
/csv - Kind
- Text and data
XML
XML documents and data.
- Extensions
- .xml
- MIME type
- application
/xml - Kind
- Text and data
In your code.The same CSV to XML conversion through the API, for your app or your agent.
$ cv convert sheet.csv sheet.xml$ cv convert sheet.csv sheet.xmlQuestions.What people ask about CSV to XML.
No. Every value becomes text, so numbers and dates are written as text inside their elements.
No. It is guessed from the rows when you leave Delimiter out. Set it to comma, semicolon, tab or pipe if you want to choose.
Characters a tag name cannot hold are turned into underscores. A heading with a space gets an underscore in its place in the element name.
No. A list repeats its element once per item, so an empty list disappears from the output.