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.
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
Enhanced XML Data Mapping
Product data might sometimes be stored in XML attributes. To navigate through elements and attributes in an XML document Stockeo relies on XPath. You can use the XPath expressions to pull data from a node's attribute or to extract data from a node containing a specific attribute with a specific value.
Extract data from an attribute
It can be that the data you want to extract from an XML and use them for creating/updating products are stored as XML attributes.
In the above example, the node with all information about a product is <product>.
Stockeo Product Element in the XML automation
The path to the nodes nested within it is relative. To get the id value which is the attribute of the product node, type the @ sign and attribute name.
Use the attribute of the stock node in the Stockeo automation
To extract an attribute value from a node nested within <product>, enter the child node name, slash, @ sign and attribute name.
Use the attribute of the stock node in the Stockeo automation
Select the node with the specific attribute
It may also happen you want to select a node with a specific attribute from which you need to extract data. Assume you would like to extract the product title from the name node containing the xml:lang="eng" attribute. In this case, provide the node name, and in the square bracket type the @ sign followed by the name of the attribute with its value. For our example XML it looks like this:
Select node with a specific attribute in the Stockeo automation
Another example illustrates a combination of both: selecting a node with a specific attribute value and extracting data from the attribute to pull all product images from the feed.
Pull data from attribute of a node with specific other attribute in Stockeo automation
<Products>
<Product>
<Code>0260</Code>
<Title>Sitting Jazz Band Saxophonist</Title>
<Price>13.73</Price>
<RRP>32.95</RRP>
<AvailableStock>181</AvailableStock>
<Barcode>5050140026007</Barcode>
<Description>A sitting jazz man, playing the saxophone.</Description>
<Image>https://www.hill-interiors.com/images/giant/0260.jpg</Image>
</Product>
<Product>
<Code>0261</Code>
<Title>Sitting Jazz Band Trumpeter</Title>
<Price>13.73</Price>
<RRP>32.95</RRP>
<AvailableStock>162</AvailableStock>
<Barcode>5050140026106</Barcode>
<Description>Bring timeless musical elegance to any setting with the Sitting Jazz Band
Trumpeter.</Description>
<Image1>https://www.hill-interiors.com/images/giant/0261.jpg</Image>
</Product>
</Products>
<Products>
<Product>
<Code>0260</Code>
<Title>Sitting Jazz Band Saxophonist</Title>
<Description>A sitting jazz man, playing the saxophone.</Description>
<Image>https://www.hill-interiors.com/images/giant/0260.jpg</Image>
<Variants>
<Variant>
<VariantCode>0260S</VariantCode>
<Price>13.73</Price>
<RRP>32.95</RRP>
<AvailableStock>181</AvailableStock>
<Barcode>5050140026007</Barcode>
<Option>Small</Option>
</Variant>
<Variant>
<VariantCode>0260M</VariantCode>
<Price>20.59</Price>
<RRP>32.95</RRP>
<AvailableStock>56</AvailableStock>
<Barcode>5050140026008</Barcode>
<Option>Medium</Option>
</Variant>
<Variant>
<VariantCode>0260L</VariantCode>
<Price>30.89</Price>
<RRP>32.95</RRP>
<AvailableStock>74</AvailableStock>
<Barcode>5050140026009</Barcode>
<Option>Large</Option>
</Variant>
</Variants>
</Product>
</Products>