Convert CSV to XML
This tool turns a CSV file with a header row into an XML document — one record element per row, with a child element for each column. It is useful for producing XML feeds, config files, or import payloads from a spreadsheet export without writing a script.
How it works
The CSV is parsed with an RFC 4180 scanner, so quoted fields containing commas,
line breaks, or doubled quotes ("") are handled correctly. The first row supplies
the column names, and each later row becomes one record element.
You choose the root element name (default rows) and the row element name
(default row). Each header is sanitised into a valid XML element name: invalid
characters and spaces become underscores, and names beginning with a digit get a
leading underscore. Cell values are entity-escaped — &→&, <→<,
>→> — so the output is always well-formed. The document is emitted with an
XML declaration, either pretty-printed with indentation or minified to a single line.
Example
The CSV name,city with a row Ada,London produces:
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<name>Ada</name>
<city>London</city>
</row>
</rows>