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 | |
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>)
- Use key for ordinary output fields across target formats. (See:
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 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
Source parsing options require source.
Attributes: source, selector, separator
Why: selector, separator, and source-dependent options only modify a source read.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
1 | |
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 | |
| Invalid combination | |
|---|---|
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.