Skip to content

Element <element>

Purpose: Define one XML-oriented field using the same value semantics as a key.

Why: Use this key form when an XML-oriented target needs element-specific field intent.

Example

1
<element name="customer_id" generator="IncrementGenerator"/>

Decision guide

Business value: Keeps XML-specific generated attributes or child values explicit in an XML product model.

  • Use when

    • An XML target needs element-oriented field semantics below a generated value.
  • Choose another approach when

    • The target is tabular or JSON and needs an ordinary product field.
  • Prerequisites

    • Place it below a compatible field container and select one value strategy.
  • Alternatives

    • Use key for ordinary output fields across target formats. (See: <key>)

Complete examples

Model XML-oriented element attributes explicitly

Use element beneath a key or nestedKey when a later XML target needs generated attributes in addition to element text; inspect the bounded record shape in task logs before publishing the XML artifact.

xml-attributes/datamimic.xml
1
2
3
4
5
6
7
8
<setup>
    <generate name="customers" count="2" target="LogExporter">
        <key name="customer" constant="active">
            <element name="id" generator="IncrementGenerator"/>
            <element name="country" constant="DE"/>
        </key>
    </generate>
</setup>

Rules and invalid combinations

A key requires one value-generation mode.

Attributes: type, source, values, script, generator, constant, pattern, string

Why: A field without a type, source, value pool, script, generator, constant, pattern, or string template cannot produce a value.

Valid combination
1
<element name="status" constant="active"/>
Invalid combination
1
<element name="status"/>
Choose exactly one explicit key generation mode.

Attributes: source, values, script, generator, constant, pattern, string

Why: Combining source, values, script, generator, constant, pattern, or string would make ownership of the field value ambiguous.

Valid combination
1
<element name="status" constant="active"/>
Invalid combination
1
<element name="status" constant="active" string="${status}"/>
weights requires an inline values pool.

Attributes: weights, values

Why: Each weight biases the corresponding values entry and has no meaning without that pool.

Valid combination
1
<element name="tier" values="'standard','premium'" weights="3,1"/>
Invalid combination
1
<element name="tier" type="string" weights="3,1"/>
unique on a key requires an inline values pool.

Attributes: unique, values

Why: Key uniqueness is sampling without replacement from explicitly listed values; generators do not expose a finite pool here.

Valid combination
1
<element name="code" values="'A','B'" unique="true"/>
Invalid combination
1
<element name="code" generator="IncrementGenerator" unique="true"/>
unique cannot be combined with weights.

Attributes: unique, weights

Why: Unique sampling is uniform without replacement; weights describe biased draws with replacement.

Valid combination
1
<element name="code" values="'A','B'" unique="true"/>
Invalid combination
1
<element name="code" values="'A','B'" weights="1,2" unique="true"/>
Source parsing options require source.

Attributes: source, selector, separator

Why: selector, separator, and source-dependent options only modify a source read.

Valid combination
1
<element name="status" source="data/status.ent.csv" separator=","/>
Invalid combination
1
<element name="status" type="string" separator=","/>
A key distribution requires an int or float range.

Attributes: distribution, type, min, max

Why: The key-level distribution shapes a numeric grid and is different from source-row distribution.

Valid combination
1
<element name="score" type="int" min="1" max="10" distribution="step"/>
Invalid combination
1
<element name="score" type="string" min="1" max="10" distribution="step"/>
outDateFormat produces a string and rejects a non-string type.

Attributes: outDateFormat, type

Why: Formatting is the final presentation step; downstream expressions no longer receive the raw temporal value.

Valid combination
1
<element name="created" constant="2026-01-02" outDateFormat="%d.%m.%Y"/>
Invalid combination
1
<element name="created" type="int" constant="2026-01-02" outDateFormat="%d.%m.%Y"/>
Integer granularity must be a whole number.

Attributes: type, granularity

Why: A fractional step cannot produce an integer grid without silent truncation.

Valid combination
1
<element name="score" type="int" granularity="2"/>
Invalid combination
1
<element name="score" type="int" granularity="0.5"/>
defaultValue requires script.

Attributes: defaultValue, script

Why: The fallback is evaluated only when the scripted value is absent or its condition suppresses generation.

Valid combination
1
<element name="nickname" script="None" defaultValue="'unknown'"/>
Invalid combination
1
<element name="nickname" constant="unknown" defaultValue="'fallback'"/>
nullQuota must be between 0 and 1.

Attributes: nullQuota

Why: The value represents a probability: 0 never emits null and 1 always emits null.

Valid combination
1
<element name="middle_name" type="string" nullQuota="0.5"/>
Invalid combination
1
<element name="middle_name" type="string" nullQuota="1.1"/>

Allowed parents / Allowed children

Allowed parents: else, else-if, id, if, item, key, nestedKey, while

Allowed children:

None

Attributes

Show all 29 attributes

condition

Condition for element data generation.

optional; string; Default: null.

constant

Constant value for element data.

optional; string; Default: null.

converter

Converter for element data transformation.

optional; string; Default: null.

database

Database client id when source equals 'database'.

optional; string; Default: null.

defaultValue

Default value for the element.

optional; string; Default: null.

distribution

Sampling distribution / sequence for ranged numeric element.

optional; string; Default: null; Values: uniform, cumulated, step, increment, randomWalk, shuffle, wedge, bitreverse, fibonacci, padovan.

generator

Predefined generators for element data generation.

optional; string; Default: null.

granularity

Step width of numeric grid; defaults 1 for int, 0.1 for float. On int, must be whole.

optional; string; Default: null.

inDateFormat

Input date format for element data.

optional; string; Default: null.

max

Maximum value for numerical generator.

optional; number; Default: null.

maxLength

Maximum length for binary payload generation.

optional; integer; Default: null.

mimeType

Optional MIME signature for binary payload generation.

optional; string; Default: null.

min

Minimum value for numerical generator.

optional; number; Default: null.

minLength

Minimum length for binary payload generation.

optional; integer; Default: null.

name

Name of the element.

required; string.

nullQuota

Null quota for element data generation.

optional; number; Default: null.

outDateFormat

Output date format for element data.

optional; string; Default: null.

pattern

Pattern for element data generation.

optional; string; Default: null.

script

Script for element data generation.

optional; string; Default: null.

selector

Selector for element data generation.

optional; string; Default: null.

separator

Separator for element data.

optional; string; Default: null.

source

Source of data for the element.

optional; string; Default: null.

string

String for the variable data generation.

optional; string; Default: null.

type

Data type of the element.

optional; string; Default: null; Values: string, int, integer, float, bool, binary.

unique

Emit each value at most once (distinct picks from values, no replacement).

optional; boolean; Default: null.

values

Comma-separated list of values for the element.

optional; string; Default: null.

variablePrefix

Prefix before field's name for string in element generation.

optional; string; Default: null.

variableSuffix

Suffix after field's name for string in element generation.

optional; string; Default: null.

weights

Comma-separated relative weights, one per values entry, for weighted random selection.

optional; string; Default: null.