XML

XML is a flexible, text-based format used for structuring and storing data, commonly used in web services and data exchange between systems.

XML settings

Product Element

The key information required by Stockeo is the node name that contains the data for a single product.

In such a case above enter Product in the Product Element field.

Product Element

Fields associated with the product are relative to the node used as Product Element:

  • Title

  • Description

  • Image URL

  • Product Type

  • Tag

  • Vendor

  • Product Metafield

Variant Element

Fill in this field only when variants are nested in the product node.

circle-info

If variants are in separate nodes at the product level and have a node with the same value for all variants of a specific product like product name, parent SKU, or parent ID, leave this field empty. For more information navigate to Variants.

In such a case above enter Variants/Variant in the Variant Element field.

Variant Element

Fields associated with the variant are relative to the node used as Variant Element:

  • SKU

  • Barcode

  • Compare at price

  • Continue selling when out of stock

  • Charge tax

  • Cost per item

  • Market Price

  • Price

  • Quantity

  • Weight

  • Variant Metafield

  • Option

An example feed mapping, where variant nodes are embedded within product nodes, may look as follows:

Data Mapping section with Variant Element

Basic Data Mapping

In most XML feeds the data you need is stored as text inside nodes, and mapping it is straightforward - just enter the node name or the path to a nested node.

The examples below use the following XML feed:

In this example the Product Element is Product.

Node name

To get the text content of a child node, enter the node name. For example, to get the product title:

Path to a nested node

Use a slash (/) to navigate deeper. For example, to reach the first image inside Images > Image:

Pick a specific item from a list with [index]

When a node appears multiple times (like several <Image> nodes), you can pick a specific one by its position. The numbering starts at 1.

For example, to get the second image:

Read an attribute with @

Some feeds store data in XML attributes rather than as text content. To read an attribute, type the @ sign followed by the attribute name.

For an attribute on the product node itself (e.g. if <Product id="3378">):

For an attribute on a nested node, combine the path with @. For example, to get the currency attribute from the <Price> node:

You can also combine a path, an index, and an attribute. For example, if images were stored as <Image url="..."/>, you would get the URL of the second image like this:

circle-info

XML namespaces (prefixes like xml:, iaiext:, etc.) are automatically stripped by Stockeo. When referencing attributes, use the name without the prefix. For example, xml:lang becomes just lang.

Advanced Data Mapping with Liquid

For anything beyond the expressions above — such as picking a node by the value of its attribute — use a Liquid template.

circle-exclamation

Consider the following XML where the product title is available in multiple languages:

Select a node by attribute value

To extract the product title from the <Name> node where the language is eng, use the where filter:

Select node with a specific attribute in the Stockeo automation
Select node with a specific attribute in the Stockeo automation

Select an image by attribute value

To pull the URL of the image with priority="1":

And for the second image (priority="2"):

Last updated