Publish / file · All operations

Write an XML or HTML file

Write XML, HTML.

Status

In arcform

Runs as a SQL step

arcform carries it as a sql: step today, with the webbed extension.

Shape of the result
the table sent out, with nothing new to look at
Level
needs a DuckDB extension

The DuckDB step

Rows rendered as XML and written to a file

It reads the orders table the proofs share. Create it first:

SQL
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);

Then run the statement:

SQL
INSTALL webbed FROM community; LOAD webbed;
COPY (SELECT to_xml({'order_id': order_id, 'customer': customer, 'amount': amount}) AS doc FROM orders) TO '<your_scratch_dir>/orders.xml' (FORMAT csv, HEADER false, QUOTE '');
CREATE TEMP TABLE result AS
SELECT len(regexp_extract_all(content, '<customer>')) AS customers, len(regexp_extract_all(content, '<order_id>')) AS ids, content LIKE '%<customer>Dev Patel</customer>%' AS has_dev FROM read_text('<your_scratch_dir>/orders.xml');
SELECT * FROM result;
SELECT CASE WHEN ((SELECT customers = 10 AND ids = 10 AND has_dev FROM result)) THEN 'as expected' ELSE error('the file does not hold ten order elements') END AS verdict;

Replace <your_scratch_dir> with a directory of your own that you can write to before running the statement.

  • The statement writes orders.xml itself, in <your_scratch_dir>.
  • It needs the webbed extension.
  • The statement checks its own result and raises an error when it is wrong: “the file does not hold ten order elements”.
  • It passed on DuckDB v2.0.0 (Cyanoptera) d54cbbe3df.

Variants

Write an RSS or Atom feed

Write rows as the items of an RSS or Atom feed.

Write an HTML table

Write the rows as an HTML table.

Write rows as XML

Write rows as XML elements, flat or built into a nested tree.

What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

Apache Hop (2)
  • XML Outputread 2026-09-27

    Write rows to one or more XML files

  • XML output (Advanced)read 2026-09-27

    Build hierarchical XML from rows, to file or field, with splits and XSD generation

Apache NiFi (1)
Duckle (1)
  • XMLread 2026-09-25

    write rows as XML elements

EasyMorph (1)
KNIME Analytics Platform (2)
  • Combine the XML cells of a column into one document and write it to a file

  • XML Writerread 2026-09-27

    Write each XML value of a column to a file in a directory

OpenRefine (1)
Pentaho Data Integration (2)
  • RSS Outputread 2026-09-27

    Write rows as an RSS feed; the reference describes it as reading an RSS stream

  • XML Outputread 2026-09-27

    Write rows to an XML file

RapidMiner Studio (1)
  • Write XRFFread 2026-09-27

    Write a table to an XRFF (XML form of ARFF) file

Talend (4)
  • tAdvancedFileOutputXMLread 2026-09-27

    Write rows to an XML file by an XML tree with loop and group elements

  • tFileOutputMSXMLread 2026-09-27

    Write an XML file of several record structures from several incoming flows

  • tFileOutputXMLread 2026-09-27

    Write rows to an XML file

  • tRSSOutputread 2026-09-27

    Write XML files holding RSS or Atom feeds

VisiData (2)
  • html (saver)read 2026-09-23

    Save as HTML table of displayed text; also filetype htm

  • xml (saver)read 2026-09-23

    Save as XML (from an XML source)

Background

In Apache Hop, the XML Output transform writes rows from any source to one or more Extensible Markup Language (XML) files.[1] Extensible Markup Language is a markup language and file format for storing, transmitting, and reconstructing data.[2] HyperText Markup Language (HTML) defines the meaning and structure of web content, and its table element represents tabular data in rows and columns of cells.[3][4]

When to use it

The XML specification defines an XML document as a well-formed text, one that satisfies the specification's list of syntax rules.[2] In an XML document there is exactly one element, called the root or document element, no part of which appears in the content of any other element.[5] An XML processor that meets a violation of the well-formedness rules is required to report the error and to cease normal processing.[2] In Apache Hop's XML output (Advanced) transform, marking the root element as the one repeated for each row gives a single row per document, because an XML document has one root element.[6] Apache NiFi's XMLRecordSetWriter wraps multiple records in a root node, whose name is set by a property.[7] When another program has to read the file as XML, wrap every row in one named root element rather than writing each row as an element of its own at the top of the file. (Meridian's view)

In XML, the less-than sign and the ampersand are key syntax markers and may never appear in content outside a CDATA section, a delimited section whose text is classified as content.[2] XML has five predefined entities for escaping characters, among them &lt; for the less-than sign and &amp; for the ampersand.[2] Escape every text value as it is written, not only the values expected to hold symbols. (Meridian's view)

Apache NiFi's XMLRecordSetWriter can leave a null or missing field out of the XML, or write it as a node without content, depending on how the writer is configured.[7] Apache Hop's XML Output transform lets each field name a string to insert when its value is null.[1] Decide, and write down, whether a missing value becomes an absent element, an empty element or a placeholder string, so that the program reading the file knows which one it is getting. (Meridian's view)

An XML schema (XSD) defines the metadata for interpreting and validating XML, and a document that adheres to its schema is called valid.[2] Where the file is going to a system that publishes a schema, validate the written file against that schema before it leaves, since a well-formed file can still be the wrong shape. (Meridian's view)

The method

Apache Hop pairs XML Output, for a flat document of repeating rows, with XML output (Advanced), for a deeper, custom-shaped XML structure.[6] In Hop's XML Output transform, the root element and the row element are both named in the settings, and each field is written as an element or as an attribute.[1] An XML attribute can only have a single value, and each attribute can appear at most once on each element.[2] Apache NiFi's XMLRecordSetWriter currently does not support writing XML attributes.[7]

In Hop's XML output (Advanced) transform, exactly one element of the tree is marked as the row loop, and each input row produces one occurrence of that element with its full subtree.[6] Ancestors of the loop element in Hop's tree can be marked group-by, so that consecutive input rows sharing the same group key are written under a single occurrence of the group element.[6] For Hop's group-by to collapse correctly, the input rows must already be sorted by the group-by keys.[6] Hop's XML output (Advanced) can write a sibling .xsd schema next to each output file, derived from the configured XML tree and the upstream row metadata.[6]

EasyMorph's Export to XML action offers a row-based layout, a collection of row elements, and a column-based layout, a collection of column elements.[8] KNIME's XML Row Combine and Write node takes the XML documents of a column, combines them into a single document under a configurable root element and writes it to a file.[9] In DuckDB's webbed community extension, the to_xml function converts any value to XML, taking an optional node name for the root element.[10]

VisiData's HTML saver writes each sheet as an HTML table whose first row holds the column names, escaping every column name and cell value with Python's html.escape.[11] Really Simple Syndication (RSS) formats are specified using a generic XML file, and an RSS feed carries full or summarised text with metadata such as publishing date and author's name.[12] The Atom syndication format, an alternative to RSS begun in June 2003, has been adopted as Proposed Standard RFC 4287.[12]

Compared with the alternatives

XML's rule that a processor stops at a well-formedness error stands in contrast to programs that process HTML, which are designed to produce a reasonable result even with severe markup errors.[2] Check a file meant for machines with a strict XML parser, not by opening it in a browser. (Meridian's view)