XML is a text format for writing structured data. Every piece of data sits between an opening and a closing tag with a name, so a computer knows exactly what the price is and what the product title is. Most product feeds for price comparison sites and Google Merchant Center are written in XML.
What is XML
XML (eXtensible Markup Language) is plain text that you can open even in Notepad. The data in it is wrapped in tags, like things packed in labelled boxes: the box says "price" and inside is 129.90. Boxes can go inside each other – a big "product" box contains smaller "title", "price" and "image" boxes.
"Extensible" means that whoever designs the format chooses the tag names. That is why Heureka uses PRODUCTNAME and Google uses g:title – both are XML, just with different labels.
A file usually starts with the header <?xml version="1.0" encoding="UTF-8"?>, which states the XML version and the character encoding.
What it looks like in a feed
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
<channel>
<item>
<g:id>SPAC-310</g:id>
<g:title>Horal Mumia 300 sleeping bag</g:title>
<g:price>79.90 EUR</g:price>
</item>
</channel>
</rss>The example is a Google Merchant feed with one product – the g: prefix marks fields from the Google specification; Heureka and Zboží.cz use a SHOP wrapper and SHOPITEM items without a prefix.
What it is used for
- Price comparison sites – Heureka and Zboží.cz accept product feeds in XML.
- Google Merchant Center – accepts XML (RSS 2.0 or Atom) as well as a tab-separated text file.
- Meta – the catalogue for Facebook and Instagram can load XML in the same shape as Google's.
- Suppliers and e-commerce platforms – product exports are very often in XML.
The advantage of XML is that it handles nested data: several images, a list of attributes, variants or several shipping methods for one product.
What to watch out for
- Every opening tag must be closed, in the right order – the inner one first, then the outer one.
- Upper and lower case matter. To a computer,
<EAN>and<ean>are two different pieces of data. - The characters
&and<in text must be written as&and<or placed in a CDATA block. - The encoding in the header must match how the file is actually saved.
- One markup error means a program won't read the file – often the whole feed stops, not just one product.
How Sortyra helps
Sortyra loads XML in standard formats (Heureka, Google, Shoptet) as well as in a supplier's own structure, and finds the repeating items by itself. A lone & character, which would stop the reading, is corrected to & on loading.
Related terms
- Feed
- Element (tag)
- XML attribute
- CDATA
- UTF-8 encoding
- More detail: Feed types: XML, CSV, JSON and Common feed errors
Frequently asked questions
What do I open an XML file with?
Any text editor, or a web browser, which displays XML as a clear tree.
Is XML better than CSV?
For more complex data (several images, attributes, variants), yes. CSV is easier to edit in a spreadsheet program.
What is an XML feed?
A product feed written in XML format – a list of products in which every piece of data sits in a tag with an exact name.