An element is the basic building block of an XML file. It consists of an opening tag with a name, the content and a closing tag. In a feed, every piece of product data – title, price, EAN or image – is stored in its own element with an exact name, which comparison sites and Google use to find it.
What is an element
A tag is a name in angle brackets, for example <PRICE_VAT>. An element is the whole thing: the opening tag, the content and the closing tag with a slash, i.e. <PRICE_VAT>129.90</PRICE_VAT>. In everyday speech the two terms are used interchangeably, and that does no harm.
Think of an element as a drawer with a label. The label says what is in the drawer ("price"), and inside is the value itself. A drawer can also contain smaller drawers – the SHOPITEM element contains the elements PRODUCTNAME, PRICE_VAT and others. These are called nested elements.
An element with no content can be written in short form as <VIDEO_URL/>.
What it looks like in a feed
<!-- Heureka, Zboží -->
<SHOPITEM>
<PRODUCTNAME>Brava Basic T-shirt white</PRODUCTNAME>
<PARAM>
<PARAM_NAME>Size</PARAM_NAME>
<VAL>M</VAL>
</PARAM>
</SHOPITEM>
<!-- Google Merchant -->
<item>
<g:title>Brava Basic T-shirt white</g:title>
<g:size>M</g:size>
</item>The same piece of data has a different element in each format: for Heureka the size is a nested PARAM element, for Google a separate g:size element.
What it is used for
A channel reads a feed by element names. Heureka and Zboží.cz look for the price in PRICE_VAT, Google in g:price. A channel usually ignores an element with an unknown name, and a missing required element means the product won't pass. So every channel's specification is essentially a list of elements – which are required, what form they take and how many times they may repeat.
What to watch out for
- A typo in the name. The channel won't recognise
PRODUCT_NAMEinstead ofPRODUCTNAME, and the product title will be missing. - Upper and lower case.
<ean>and<EAN>are two different elements. - A missing prefix. In a Google feed, field names take the
g:prefix, and the Google namespace must be declared in the header. - Unclosed or overlapping elements make the whole file unreadable.
- Empty elements. Google recommends leaving empty fields out altogether.
How Sortyra helps
In the source detail, the Structure tab shows all the fields of a supplier's feed with how often they are filled in, and flags any that are Gone, Emptied or New. On the Mapping tab you assign the supplier's elements to Sortyra fields.
Related terms
- XML
- XML attribute
- Feed item
- Field mapping
- More detail: Feed types and Fields and values
Frequently asked questions
What is the difference between a tag and an element?
A tag is just the marker in angle brackets; an element is the whole section from the opening to the closing tag, including the content.
What does g: before an element name mean?
It is the Google namespace prefix. It says that the element belongs to the Google Merchant Center specification.
Does the order of elements in an item matter?
For ordinary feeds for comparison sites and Google, generally not – what matters is that the element is in the right item and has the right name.