How the CSV to XML Converter Works
AnyTool CSV to XML reads the uploaded file with the browser FileReader API and parses it with a full RFC 4180 reader, so commas, quotes and newlines inside quoted fields are handled correctly. The delimiter (comma, semicolon, tab or pipe) is auto-detected from the first line, and the header row supplies the column names. To build the document it wraps every data row in a configurable row element inside a single configurable root element, and for each column it either emits a child element or, if you toggle that column, an attribute on the row. Header names are sanitised into valid XML names — illegal characters become underscores and names starting with a digit get an underscore prefix — and every value is XML-escaped. The XML is regenerated live in a debounced effect as you change options, with nothing sent to a server.
- RFC 4180 parser with automatic delimiter detection
- Configurable root element (default <data>) and row element (default <record>)
- Per-column choice of child element or attribute on the row
- Header names sanitised to valid XML names; values XML-escaped
- Conversion regenerates live in the browser — no server round-trip
