Default XML shape
- Input
- CSV headers were id,name,note,zip,active,amount,date,empty.
- Output
- XML began <rows><row><id>1</id><name>Ada, Inc.</name> and ended missing values as self-closing child elements.
CSV to XML wraps parsed rows under a rows root and writes one repeated row element per record, so CSV headers become XML element names.
From real runs
| Element | Result | What happens |
|---|---|---|
| Root wrapper | Changed | The XML writer created a rows document around the converted records rather than preserving any CSV filename context. |
| Row elements | Changed | Each CSV data row became a repeated row element by default, with children named from the header cells. |
| Blank values | Changed | Empty and padded cells were emitted as self-closing elements such as <empty/> and <zip/>. |
| Escaped text | Changed | The text He said "Hi" became He said "Hi" in XML output. |
| Dates and numbers | Changed | Dates were expanded to UTC timestamp strings, and leading-zero numeric text was not preserved. |
| Multiline content | Kept | The newline inside the note column was written inside one note element instead of splitting the XML row. |
The XML writer created a rows document around the converted records rather than preserving any CSV filename context.
Each CSV data row became a repeated row element by default, with children named from the header cells.
Empty and padded cells were emitted as self-closing elements such as <empty/> and <zip/>.
The text He said "Hi" became He said "Hi" in XML output.
Dates were expanded to UTC timestamp strings, and leading-zero numeric text was not preserved.
The newline inside the note column was written inside one note element instead of splitting the XML row.
We converted our CSV sample (226 B) with Table engine on 2026-09-11. It took 1 ms and produced a 750 B XML file, 3.3× larger than the input. The engine raised no warnings.
Input · sample.csv · 226 B
4 data rows × 5 columns; header: company,stage,arr,owner,close_date
Output · sample.xml · 750 B
25 elements, root <rows>
First lines of the output
<rows>
<row>
<company>Northwind Traders</company>
<stage>Proposal</stage>
<arr>48000</arr>
<owner>R. Ayers</owner>
<close_date>2026-10-14T00:00:00.000Z</close_date>
</row>
<row>
<company>Contoso Ltd</company>
<stage>Negotiation</stage>
<arr>120000</arr>
<owner>P. Ng</owner>
<close_date>2026-09-30T00:00:00.000Z</close_date>
</row>
<row>
<company>Fabrikam</company>
<stage>Qualified</stage>
…Python csv and ElementTree
python - <<'PY'
import csv, xml.etree.ElementTree as ET
root = ET.Element("rows")
with open("input.csv", newline="", encoding="utf-8-sig") as f:
for record in csv.DictReader(f):
row = ET.SubElement(root, "row")
for key, value in record.items():
ET.SubElement(row, key).text = value or None
ET.ElementTree(root).write("output.xml", encoding="utf-8", xml_declaration=True)
PYElement names must be legal XML names; clean CSV headers before using this on uncontrolled files.
The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=csv&to=xml.
curl -X POST https://filetypeconverters.com/api/v1/convert \
-H "Authorization: Bearer $FTC_API_KEY" \
-F "file=@input.csv" -F "from=csv" -F "to=xml" \
-F 'options={"delimiter":","}' \
--output output.xml| Key | Applies to | Type | Default |
|---|---|---|---|
| delimiter | Reading CSV | string | , |
| header | Reading CSV | boolean | true |
| quote | Reading CSV | string | " |
| encoding | Reading CSV | utf-8 · latin1 | utf-8 |
| delimiter | Writing XML | string | , |
| newline | Writing XML | · | |
| sheetName | Writing XML | string | |
| dialect | Writing XML | postgres · mysql · sqlite | postgres |
| tableName | Writing XML | string | data |
| createTable | Writing XML | boolean | true |
The current writer uses rows as the root wrapper. Inside it, each record is a repeated row element unless the rowElement option is changed.
They are self-closing elements in the output we tested. For example, the blank empty column was written as <empty/>.
Yes, if a header contains spaces, leading digits, or punctuation that XML element names reject. Clean headers before conversion when the file comes from an uncontrolled source.