Turning a table into an XML document
Many systems that accept bulk data want XML: product feeds for marketplaces and price comparison sites, imports into ERP and accounting software, legacy integrations. The data itself usually lives in a spreadsheet. This converter bridges the two — export the sheet as CSV, paste it here, and you have the element structure most of those formats are built on.
The mapping is deliberately simple. The whole table is wrapped in one root element. Each row becomes a row element. Each column becomes a child element named after its header, containing the cell's value.
Element names from headers
Headers are used as tag names. Spaces and other characters XML does not allow are replaced with underscores, so Unit price becomes Unit_price.
Escaping
&, < and > in cells are written as entities. A description containing HTML will not break the document.
Empty cells
An empty cell becomes a self-closing element such as <description/>, so every row keeps the same set of children.
Values as written
Type detection is off by default: prices like 19.90 keep their trailing zero, which matters in feeds.
Fitting a target format
A feed specification normally dictates exact element names, and sometimes attributes or nesting. The easiest route is to rename the CSV headers to the required tag names before converting, and set the root and row names to what the specification asks for. If the target needs attributes or grouped elements, convert to JSON first, reshape the data, then use the JSON to XML converter, where keys starting with @ become attributes.
Frequently asked questions
How is each CSV row represented in XML?
As one element — named "row" by default, or whatever you enter — containing a child element for every column, named after the column header.
Can columns become attributes instead of child elements?
Not directly. Convert the CSV to JSON, prefix the relevant keys with @, and run the result through the JSON to XML converter.
What if a header is not a valid XML name?
Invalid characters are replaced with underscores and a name starting with a digit is prefixed with one, so the output is always well-formed.
Does the output include an XML declaration?
Yes: version 1.0 with UTF-8 encoding. Save the file as UTF-8 so that non-ASCII characters are read correctly.