DEVELOPER & DATA

XML to CSV

XML becomes a table: the repeating record is found or named, nested elements flatten to dotted paths, attributes take a prefix, and the result downloads as CSV.

A CSV file with one row per record and the union of every record’s keys as the header, plus the record path, the column count, the empty and ragged cells, and the other repeating elements it could have used.

Example: A catalogue of two books becomes five columns — @id, @lang, title, author, price — with the second book’s two authors joined as "Austen; Ed." and its missing price left empty.

v0.1.0 · last reviewed 22 September 2026
Loading the workspace…
BUILT TO BE UNDERSTOOD

A table needs
repeating records.

How the record element is found, how a tree is flattened into columns, and when it cannot be done cleanly.

Finding the records

CSV has rows, XML has a tree, and the bridge between them is a repeating element. The page finds the most numerous group of same-named siblings and makes one row per occurrence — in a catalogue of books, that is the book element. Every other candidate it found is listed, so if it picked the wrong one you can name the right one by name or by path. A document with no repeated siblings still converts: it becomes a single row, which is usually what you want from a config file.

Flattening

Within a record, every leaf value becomes a column. Nested elements flatten to dotted paths, so address/city becomes address.city; attributes take the prefix you set, @id by default, which keeps them from colliding with an element of the same name. A leaf that repeats inside one record can be joined with a separator, split into numbered columns, or reduced to the first value. The header is the union of every record’s keys in first-seen order, and missing values are left empty rather than shifted.

Limits

Comments and processing instructions are dropped, mixed content (text interleaved with child elements) keeps only the text, and namespaces are kept as written rather than resolved. A deeply irregular document will not become a clean table, so the page reports the empty cells and how many records are missing a column instead of silently producing something tidy-looking. Output is RFC 4180 quoted, or fully quoted on request. Nothing leaves the browser; the same four anonymous usage counts as the rest of the site apply.

SOURCES

  • The record is the most numerous group of same-named siblings, or the path you name; leaves flatten to dotted paths, attributes take your prefix; RFC 4180 quoting; comments and PIs are dropped

Last reviewed 22 September 2026. How results are checked: How we verify.