# XML Document

Key: `container.object.xml`

XML (Extensible Markup Language) document stored as VARCHAR. Structured hierarchical data with tags and attributes.

Page: <https://meridian.online/docs/projects/finetype/types/container/object/xml>

Samples: `<root><name>John</name><age>30</age></root>`, `<user id="123"><email>john@example.com</email></user>`

## Background

### Origin

XML was developed by an XML Working Group formed under the auspices of the World Wide Web Consortium (W3C) in 1996.[[1]](https://www.w3.org/TR/xml/) The XML Working Group was originally known as the SGML Editorial Review Board.[[1]](https://www.w3.org/TR/xml/) The XML Working Group was chaired by Jon Bosak of Sun Microsystems.[[1]](https://www.w3.org/TR/xml/) XML 1.0 was published as a W3C Recommendation on 10 February 1998.[[2]](https://www.w3.org/TR/1998/REC-xml-19980210) The first edition of XML 1.0 was edited by Tim Bray, Jean Paoli and C. M. Sperberg-McQueen.[[2]](https://www.w3.org/TR/1998/REC-xml-19980210)

The XML specification describes XML as a subset of SGML, the Standard Generalized Markup Language of ISO 8879:1986.[[1]](https://www.w3.org/TR/xml/) The XML specification states that its goal is to enable generic SGML to be served, received and processed on the Web in the way that is possible with HTML.[[1]](https://www.w3.org/TR/xml/) One of the design goals listed in the XML specification is that terseness in XML markup is of minimal importance.[[1]](https://www.w3.org/TR/xml/)

The current edition of XML 1.0 is the Fifth Edition, a W3C Recommendation dated 26 November 2008.[[1]](https://www.w3.org/TR/xml/) The XML 1.0 Fifth Edition states that it is not a new version of XML but incorporates the accumulated errata to the Fourth Edition.[[1]](https://www.w3.org/TR/xml/)

### Use

Wikipedia's article on XML says that hundreds of document formats using XML syntax have been developed, including RSS, Atom, Office Open XML, OpenDocument, SVG and XHTML.[[3]](https://en.wikipedia.org/wiki/XML) Wikipedia's article on XML names SOAP and XMPP as communication protocols that use XML as their base language.[[3]](https://en.wikipedia.org/wiki/XML) Wikipedia's article on XML lists Health Level 7, FpML, MISMO and the National Information Exchange Model among industry data standards based on XML.[[3]](https://en.wikipedia.org/wiki/XML)

Under the XML specification, a well-formed document has exactly one element, called the root or document element, no part of which appears in the content of any other element.[[1]](https://www.w3.org/TR/xml/) The XML specification says XML documents should begin with an XML declaration that specifies the version of XML being used.[[1]](https://www.w3.org/TR/xml/) The XML specification requires all XML processors to accept the UTF-8 and UTF-16 encodings of Unicode.[[1]](https://www.w3.org/TR/xml/)

PostgreSQL's xml data type checks input values for well-formedness, which the PostgreSQL manual gives as its advantage over storing XML in a text field.[[4]](https://www.postgresql.org/docs/current/datatype-xml.html) PostgreSQL's xml type can store content fragments with more than one top-level element as well as full documents.[[4]](https://www.postgresql.org/docs/current/datatype-xml.html) PostgreSQL's xml type does not validate input values against a document type declaration (DTD), even when the input value specifies one.[[4]](https://www.postgresql.org/docs/current/datatype-xml.html) SQL Server's xml data type has a DOCUMENT facet that requires one and only one root element, and a CONTENT facet that allows zero or more top-level elements.[[5]](https://learn.microsoft.com/en-us/sql/t-sql/xml/xml-transact-sql?view=sql-server-ver17) Microsoft's documentation says a stored instance of SQL Server's xml data type cannot exceed 2 gigabytes in size.[[5]](https://learn.microsoft.com/en-us/sql/t-sql/xml/xml-transact-sql?view=sql-server-ver17) Check whether your target column expects a whole document or a fragment before you load a source that mixes the two. (Meridian's view)

DuckDB's webbed community extension describes itself as a processing extension for XML and HTML, with XPath-based data extraction and schema inference.[[6]](https://duckdb.org/community_extensions/extensions/webbed) The webbed extension is installed in DuckDB with INSTALL webbed FROM community.[[6]](https://duckdb.org/community_extensions/extensions/webbed) Python's XML documentation directs anyone who needs to parse untrusted or unauthenticated data to its XML security section.[[7]](https://docs.python.org/3/library/xml.html) Python's XML documentation describes the Billion Laughs attack, in which nested entity definitions expand into several gigabytes of text.[[7]](https://docs.python.org/3/library/xml.html) Treat XML from an outside source as untrusted input and parse it with entity expansion limited or switched off. (Meridian's view)

### Where you'll meet it

legislation.gov.uk's Legislation Schema uses Dublin Core for metadata, XHTML for tables and MathML for formulae.[[8]](https://www.legislation.gov.uk/developer/formats/xml)

## Sources

1. [Extensible Markup Language (XML) 1.0 (Fifth Edition)](https://www.w3.org/TR/xml/) — standard
2. [Extensible Markup Language (XML) 1.0](https://www.w3.org/TR/1998/REC-xml-19980210) — standard
3. [XML - Wikipedia](https://en.wikipedia.org/wiki/XML) — secondary source
4. [PostgreSQL: Documentation: 18: 8.13. XML Type](https://www.postgresql.org/docs/current/datatype-xml.html) — documentation
5. [xml (Transact-SQL) - SQL Server \| Microsoft Learn](https://learn.microsoft.com/en-us/sql/t-sql/xml/xml-transact-sql?view=sql-server-ver17) — documentation
6. [webbed – DuckDB Community Extensions](https://duckdb.org/community_extensions/extensions/webbed) — documentation
7. [XML Processing Modules — Python 3.15.0 documentation](https://docs.python.org/3/library/xml.html) — documentation
8. [XML Format](https://www.legislation.gov.uk/developer/formats/xml) — organisation
