SEO glossary · E

Extensible Markup Language (XML)

What is XML?

XML (Extensible Markup Language) is a text format for storing and exchanging structured data. Like HTML it uses tags, but instead of describing how a page looks, XML tags describe what the data is, and you can define your own tags for any kind of information.

Example

<product>
  <name>Running shoe</name>
  <price currency="SEK">899</price>
</product>

Where XML is used

  • XML sitemaps that list a website’s URLs for search engines
  • RSS and Atom feeds for blogs and podcasts
  • Product feeds, for example for Google Merchant Center
  • Data exchange between business systems, and office file formats such as .docx

XML vs JSON

JSON has replaced XML in many web APIs because it is shorter and easier to use in JavaScript, and structured data for search engines is usually written in JSON-LD. XML remains the standard for sitemaps and feeds.

XML sitemap example

A sitemap is the XML file most site owners meet. Each page is listed inside a url tag with its address (loc) and the date it last changed (lastmod). Search engines read the file to find pages and to decide which ones changed. A product feed for Google Merchant Center works the same way, with a tag for each product attribute.

XML basics to know

  • Every opening tag needs a closing tag.
  • Tags are nested and must be closed in the right order.
  • Special characters such as & and < must be written as entities.
  • The file should be saved as UTF-8.
  • One broken tag can make the whole file unreadable, so validate it.

XML mistakes

  • Forgetting to escape an ampersand in a URL, which breaks the sitemap.
  • Listing URLs that redirect, return errors or are blocked by robots.txt.
  • Not updating the lastmod date correctly, so search engines cannot trust it.
  • Editing a feed by hand and introducing a syntax error.

XML FAQs

What is the difference between XML and HTML?

HTML describes how a web page is displayed. XML describes the data. Read about the XML sitemap and RSS.

Do I need to write XML myself?

Usually not. Your CMS or an SEO plugin generates sitemaps and feeds. See CMS.

Get in touch

Know the term. Now rank for it.

Tell us the search you want to win. A specialist reads it and replies by email, and if it helps, we set up a short call.

    A specialist reads your message and replies by email.