XML/HTML

Overview

Data structure support

++

XML is very flexible as each element can have attributes and arbitrary child elements.

Standardisation

++

XML is well standardised, the specification can be found at https://www.w3.org/TR/xml/. XML supports both DOM style and streaming SAX style parsers.

Schema-IDL

++

XML schema, RELAX NG

Language support

+

Supported in all major languages, usually with built-in libraries.

Human readability

+-

XML is a human-readable serialisation protocol. One disadvantage of XML is it’s verbosity, in particular it’s descriptive end tags.

Speed

+

XML is quite fast, although typically slower to parse than JSON.

File size

--

XML has the largest file size in comparison.

Example

books.xml
<?xml version="1.0"?>

<!--
SPDX-FileCopyrightText: 2022 Veit Schiele

SPDX-License-Identifier: BSD-3-Clause
-->

<catalog>
   <book id="1">
      <title>Python basics</title>
      <language>en</language>
      <author>Veit Schiele</author>
      <license>BSD-3-Clause</license>
      <date>2021-10-28</date>
   </book>
   <book id="2">
      <title>Jupyter Tutorial</title>
      <language>en</language>
      <author>Veit Schiele</author>
      <license>BSD-3-Clause</license>
      <date>2019-06-27</date>
   </book>
   <book id="3">
      <title>Jupyter Tutorial</title>
      <language>de</language>
      <author>Veit Schiele</author>
      <license>BSD-3-Clause</license>
      <date>2020-10-26</date>
   </book>
   <book id="4">
      <title>PyViz Tutorial</title>
      <language>en</language>
      <author>Veit Schiele</author>
      <license>BSD-3-Clause</license>
      <date>2020-04-13</date>
   </book>
</catalog>