XML Generator

See also


XML Specification

Creating an empty element

Each XML-element is specified as a nested json object. All elements require the name parameter so the most simple specification we can have is

    "-name": "file"

This will however generate an error since no empty elements are created by default and XML files without elements are invalid. We can fix this by setting the -allowEmpty parameter:

    "-name": "file",
    "-allowEmpty": true

Which will generate


XML Variables

XML variables are what allows us to reuse the same profile for multiple IPs with different values.

In the specification for a XML file we can write the following to define an element with its text set to a variable

    "-name": "myelement",
    "#content": [{"var": "myvar"}]

If we create this with myvar = "hello world" we get the following XML

<myelement>hello world</myelement>

We could also add a static prefix and/or suffix

    "-name": "myelement",
    "#content": [{"text": "hello "}, {"var": "myvar"}, {"text": ", how are you?"}]

Used with myvar = "world" we get

<myelement>hello world, how are you?</myelement>

Reserved XML Variables

This is a list of reserved variables that can be used in profiles to get more dynamic, automatically populated data.


Generates a new UUID


ID of the IP


UUID of the IP


Label of the IP


Path of the IP


Start date of the IP


End date of the IP


Time at generation of element


Logged in user


Name of XML file being generated


The directory name for the current external XML file


The directory path and name for the current external XML file


Timestamp of when the tar/zip-file was generated


The container format of the IP, e.g. tar or zip


The id of the Submission Agreement


The name of the Submission Agreement


The archivist organization of the Information Package


The information class of the Information Package


The policy uuid of the Information Package


The policy id of the Information Package


The policy name of the Information Package


transfer project profile id


submit description profile id


sip profile id


aip profile id


dip profile id


content type profile id


authority information profile id


archival description profile id


preservation metadata profile id


data selection profile id


import profile id


workflow profile id

In addition to the list above, all parameters can also be accessed with the _PARAMETER_{ENTITY} syntax where {ENTITY} is the name of the parameter.

XML Formatters

XML formatters are suffixes that can be used to transform variables. They can be used by appending a __{FORMAT} suffix to a variable:

    "#content": [{"var": "created___DATE"}]

If we create this with created = "2018-02-05 12:30:25" we get the following XML



Keep only the date part of the variable


Convert the variable to local timezone with a UTC offset

Django Templates

In addition to the variables and formatters above we can also use the Django Template Engine by using a string instead of a dictionary:

    "-name": "myelement",
    "#content": "hello {{myvar}}, how are you?"

used with myvar = "world" results in

<myelement>hello world, how are you?</myelement>

All Django tags and filters works too:

    "-name": "myelement",
    "#content": "{% load tz %}The time is now {% timezone 'UTC' %}{% now 'c' %}{% endtimezone %}"
<myelement>The time is now 2018-03-05T12:36:55.089440+00:00</myelement>

Template Tags

In addition to Django’s built-in tags there are the essxml template tags available by using {% load essxml %}


Generates a version 4 UUID