XML Templates

generate XML files with your shop data

DataKick contains powerful yet easy to use XML Template editor. You can use it to build XML templates that can be translated to XML files.

What is XML Template

XML template is a recipe that tells DataKick how to export and format your data into XML file. It looks pretty similar to an actual XML format - it also contains both nodes and attributes. The difference is that inside these nodes and attributes you can write expressions that will be evaluated during runtime.

XML Template

Nodes

Template is a tree of nodes. Every node can contain either static text (grey), expression (green), or other nodes.

We further divide nodes to common and data nodes. Most of the nodes in the XML templates are common nodes. In the above picture, every node except <product> belongs to this category. When generating an XML file, common nodes are simply copied from the template to the output file, with every expression evaluated.

You can convert any common node to a data node by assigning a data collection to it. When generating an XML file, data nodes are repeated in the output for every record in data collection. Data nodes can optionally have conditions to filter the data. For example, you can use this to export only products from specific category.

When you create a data node you must assign unique alias to it. This data node, and all its children, can then use the alias inside any expression to get value of collection fields. In our example, <name> node shows product name.

Attributes

Every node can have associated any number of attributes. In the above picture, <product> node has an attribute id. Attributes can contain only static text or an expression

XML Editor

The only way to create templates is to use our built-in visual editor. This ensures that templates are always valid and without any errors. Editor also assists you with every aspect of authoring process. You will have information about the nodes and attributes that are available in given context. You can also use preview functionality to quickly check that your xml file has the right data.