XML Document
container.object.xmlXML (Extensible Markup Language) document stored as VARCHAR. Structured hierarchical data with tags and attributes.
Shape
^<.*>.*</.*>$| Value | Length | Shape |
|---|---|---|
| <root><name>John</name><age>30</age></root> | 43 | matches |
| <user id="123"><email>john@example.com</email></user> | 53 | matches |
| <root><name>John</name><age>30</age></root | 42 | rejected: one character short |
Told apart
1 of the 6 other object types accept every one of these samples on shape alone.
- CSV Recordmatches them by pattern
Going the other way, this type's own rule accepts 5 of 6 samples of HTML Content.
Background
Origin
XML was developed by an XML Working Group formed under the auspices of the World Wide Web Consortium (W3C) in 1996.[1] The XML Working Group was originally known as the SGML Editorial Review Board.[1] The XML Working Group was chaired by Jon Bosak of Sun Microsystems.[1] XML 1.0 was published as a W3C Recommendation on 10 February 1998.[2] The first edition of XML 1.0 was edited by Tim Bray, Jean Paoli and C. M. Sperberg-McQueen.[2]
The XML specification describes XML as a subset of SGML, the Standard Generalized Markup Language of ISO 8879:1986.[1] 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] One of the design goals listed in the XML specification is that terseness in XML markup is of minimal importance.[1]
The current edition of XML 1.0 is the Fifth Edition, a W3C Recommendation dated 26 November 2008.[1] 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]
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] Wikipedia's article on XML names SOAP and XMPP as communication protocols that use XML as their base language.[3] 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]
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] The XML specification says XML documents should begin with an XML declaration that specifies the version of XML being used.[1] The XML specification requires all XML processors to accept the UTF-8 and UTF-16 encodings of Unicode.[1]
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] PostgreSQL's xml type can store content fragments with more than one top-level element as well as full documents.[4] PostgreSQL's xml type does not validate input values against a document type declaration (DTD), even when the input value specifies one.[4] 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] Microsoft's documentation says a stored instance of SQL Server's xml data type cannot exceed 2 gigabytes in size.[5] 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] The webbed extension is installed in DuckDB with INSTALL webbed FROM community.[6] Python's XML documentation directs anyone who needs to parse untrusted or unauthenticated data to its XML security section.[7] Python's XML documentation describes the Billion Laughs attack, in which nested entity definitions expand into several gigabytes of text.[7] 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]
Sources
- [1]Extensible Markup Language (XML) 1.0 (Fifth Edition)standard
- [2]Extensible Markup Language (XML) 1.0standard
- [3]XML - Wikipediasecondary source
- [4]PostgreSQL: Documentation: 18: 8.13. XML Typedocumentation
- [5]xml (Transact-SQL) - SQL Server | Microsoft Learndocumentation
- [6]webbed – DuckDB Community Extensionsdocumentation
- [7]XML Processing Modules — Python 3.15.0 documentationdocumentation
- [8]XML Formatorganisation
Detection notes
v1 migration: New for v2. XML is less common in modern data pipelines, and adoption is decreasing. DuckDB has limited native XML support (xmlparse requires extension). Recursive inference may be partial.
Use it
$ finetype infer -i "<root><name>John</name><age>30</age></root>" --mode column
→ container.object.xml
SELECT ft_infer('<root><name>John</name><age>30</age></root>');
-- → 'container.object.xml'CAST({col} AS VARCHAR)Schema
https://meridian.online/schemas/container.object.xml · Frictionless type string
finetype taxonomy container.object.xml -o json-schema