How to convert XML and CSV
XML can model complex hierarchical documents; CSV is a flat table. This converter is designed for repeated simple records, such as rows containing name and city elements, not arbitrary XML with attributes, namespaces or mixed content.
Example XML input
<rows><row><name>Alice</name><city>Hanoi</city></row></rows>Example CSV output
name,city
Alice,HanoiIdentify repeating rows
XML → CSV expects one root containing record elements, each with flat child fields. The first set of field names becomes the CSV header. Attributes and nested child structures are rejected because they cannot be represented faithfully as ordinary cells.
Create valid XML field names
CSV → XML uses column headings as element names. Headings with spaces or invalid XML name characters cannot be written as element names and produce an error. Text characters such as ampersands and angle brackets are escaped in the resulting XML.
Count records before import
After conversion, verify that the number of XML records equals the number of CSV data rows. Check empty values, Unicode and escaped characters. When metadata, namespaces or attribute semantics matter, choose a richer mapping approach.
Frequently asked questions
Can I convert arbitrary XML documents?
No. XML hierarchies and attributes cannot be flattened without a mapping rule; this tool supports flat repeated records only.
Does CSV → XML escape ampersands?
Yes. Text is escaped for XML, and invalid XML characters are rejected.