SQL to XML
Turn the data in a SQL dump into XML. Every table with INSERT rows becomes an element containing one row element per record; values are written as child elements or attributes, NULL can be marked with xsi:nil, text is escaped so ampersands and angle brackets stay valid, and column names that are not legal XML names are adjusted.
- Runs in your browser
- No sign-up
- Free to use
How to use SQL to XML
- Paste a SQL dump with INSERT statements.
- Choose elements or attributes for values.
- Choose how NULL is represented and the root name.
- Copy or download the XML.
SQL to XML features
All tables
One element per table, one row element per record.
Elements or attributes
Two common XML layouts for row data.
NULL handling
xsi:nil, empty elements or left out.
Well-formed output
Escaped text and valid element names.
Dump parser
Same tested parser as SQL to JSON and SQL to CSV.
Local
Converted in your browser; nothing is executed.
When to use SQL to XML
- Feeding database data into an XML-based integration or ETL tool.
- Producing XML fixtures for tests from a SQL dump.
- Exchanging data with systems that only accept XML.
- Transforming rows with XSLT.
SQL to XML FAQ
What does the XML look like?
A root element contains one element per table, which contains a row element for each record. Each column becomes a child element, or an attribute in attribute mode.
What is xsi:nil?
The XML Schema way of saying an element has no value, distinct from an empty string. The namespace declaration is added to the root automatically.
What happens to column names with spaces?
XML names cannot contain spaces or start with digits, so such characters become underscores, and a note tells you how many names changed.
Are special characters escaped?
Yes. &, < and > in values are written as entities, so the output is always well-formed.
Can it read pg_dump COPY data?
No. Export with --inserts so the dump contains INSERT statements.
Is my data uploaded?
No. Everything happens in your browser.
Representing table rows in XML
XML remains common in enterprise integrations, document workflows and older APIs, while databases hand out their data as SQL. Converting the rows of a dump into XML bridges the two without a database or an export script: the INSERT statements are parsed and each row is written as an XML element.
Rows can be represented in two ways. Child elements give each column its own element, which handles long text and nested processing well. Attributes put each column on the row element itself, which is compact and easy to read for short values. Both are well-formed XML that any parser can read.
NULL needs a decision, because XML has no direct equivalent. The XML Schema instance attribute xsi:nil="true" marks a missing value explicitly and is understood by schema-aware tools; an empty element is simpler but indistinguishable from an empty string; leaving the element out works when the consumer treats missing as NULL.
Correctness is handled automatically. Text is escaped so that ampersands and angle brackets do not break the document, and column or table names that are not valid XML names, for example names with spaces or starting with a digit, are adjusted with underscores. The number of adjusted names is reported so you can map them back.
The SQL is read by the same parser used by the SQL to JSON and SQL to CSV tools, which understands multi-row INSERTs, quoting styles and escapes, and never executes anything.