What XML is

XML (Extensible Markup Language) is a text format for recording and transferring data. The data sits between tags that you can name however you need, hence “extensible”. An XML file is readable by both people and computers, and you can open it in an ordinary text editor.

A simple example of a product record:

<product><name>Green tea</name><price>4.90</price></product>

The difference between XML and HTML

Both languages use tags in angle brackets, and both derive from the older SGML standard. Their purpose differs, though:

  • HTML has a fixed set of tags and determines how content is displayed in the browser.
  • XML has no fixed tags and describes what the data means. On its own it displays nothing.

XML is also stricter: every tag must be closed, otherwise the file is invalid.

Where XML is used

  • Product feeds: online shops use XML to send their product lists to Google Merchant Center, Heureka or price comparison sites. More under product feed.
  • Sitemaps: the sitemap.xml file tells search engines which pages exist on the website. See sitemap.
  • Data exchange between systems: an online shop and accounting software, a warehouse, a carrier, an ERP.
  • Electronic invoicing: e-invoices and reports to the tax authority.
  • RSS feeds: subscribing to updates from blogs and podcasts.
  • Office documents: .docx and .xlsx files are packages of XML files inside.

XML or JSON

Modern APIs more often use JSON, which is shorter and easier to process in JavaScript. XML remains the standard, however, where precise structure and validation matter: in feeds, invoicing and enterprise systems.

Connecting systems via XML

Need to connect your online shop to a supplier, warehouse or accounting software, or prepare a feed for advertising? I can design and build it as part of my web applications service, or for WordPress as a custom plugin.