Element <element>¶
Zweck: Definiert ein XML-orientiertes Feld mit denselben Wertsemantiken wie ein key.
Warum: Verwende diese key-Form, wenn ein XML-orientiertes Ziel eine elementspezifische Feldabsicht benötigt.
Beispiel¶
1 | |
Entscheidungshilfe¶
Fachlicher Nutzen: Hält XML-spezifische erzeugte Attribute oder Kindwerte in einem XML-Produktmodell explizit.
-
Verwenden, wenn
- Wenn ein XML-Ziel elementorientierte Feldsemantik unterhalb eines Werts benötigt.
-
Anderen Ansatz wählen, wenn
- Wenn ein tabulares oder JSON-Ziel ein gewöhnliches Produktfeld benötigt.
-
Voraussetzungen
- Platziere element unter einem kompatiblen Feldcontainer und wähle eine Wertstrategie.
-
Alternativen
- Verwende key für gewöhnliche Ausgabefelder über Zielformate hinweg. (Siehe:
<key>)
- Verwende key für gewöhnliche Ausgabefelder über Zielformate hinweg. (Siehe:
Vollständige Beispiele¶
XML-Elementattribute explizit modellieren
Verwende element unter einem key oder nestedKey, wenn das XML-Artefakt neben Elementtext auch generierte Attribute benötigt.
| xml-attributes/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 | |
Regeln und ungültige Kombinationen¶
Ein Feld benötigt genau einen Modus zur Werterzeugung.
Attribute: type, source, values, script, generator, constant, pattern, string
Warum: Ein Feld ohne Typ, Quelle, Wertepool, Skript, Generator, Konstante, Pattern oder String-Template kann keinen Wert erzeugen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Wähle genau einen expliziten Erzeugungsmodus für das Feld.
Attribute: source, values, script, generator, constant, pattern, string
Warum: Die Kombination mehrerer Wertquellen würde die Herkunft des Feldwerts mehrdeutig machen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
weights erfordert einen Inline-Pool in values.
Attribute: weights, values
Warum: Jedes Gewicht beeinflusst den entsprechenden values-Eintrag und hat ohne diesen Pool keine Bedeutung.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique erfordert einen Inline-Pool in values.
Attribute: unique, values
Warum: Feldeindeutigkeit zieht ohne Zurücklegen aus expliziten Werten; Generatoren stellen hier keinen endlichen Pool bereit.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
unique darf nicht mit weights kombiniert werden.
Attribute: unique, weights
Warum: Unique-Auswahl zieht gleichverteilt ohne Zurücklegen; Gewichte beschreiben verzerrte Ziehungen mit Zurücklegen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Optionen zum Quellenlesen erfordern source.
Attribute: source, selector, separator
Warum: selector, separator und weitere Quellenoptionen verändern ausschließlich einen Quellenzugriff.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Eine Feld-distribution erfordert einen int- oder float-Wertebereich.
Attribute: distribution, type, min, max
Warum: Die Distribution auf Feldebene formt ein numerisches Raster und ist nicht die Verteilung von Quelldatensätzen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
outDateFormat erzeugt einen String und lehnt einen anderen type ab.
Attribute: outDateFormat, type
Warum: Formatierung ist der letzte Darstellungsschritt; nachgelagerte Ausdrücke erhalten nicht mehr den rohen Zeitwert.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Die Granularität eines Integer-Felds muss ganzzahlig sein.
Attribute: type, granularity
Warum: Ein Bruchschritt kann ohne stille Kürzung kein Integer-Raster erzeugen.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
defaultValue erfordert script.
Attribute: defaultValue, script
Warum: Der Fallback wird nur ausgewertet, wenn der Skriptwert fehlt oder seine condition die Erzeugung unterdrückt.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
nullQuota muss zwischen 0 und 1 liegen.
Attribute: nullQuota
Warum: Der Wert ist eine Wahrscheinlichkeit: 0 erzeugt nie null, 1 erzeugt immer null.
| Gültige Kombination | |
|---|---|
1 | |
| Ungültige Kombination | |
|---|---|
1 | |
Erlaubte Elternelemente / Erlaubte Kindelemente¶
Erlaubte Elternelemente: else, else-if, id, if, item, key, nestedKey, while
Erlaubte Kindelemente:
Keine
Attribute¶
Alle 29 Attribute anzeigen
condition
Condition for element data generation.
optional; string; Standardwert: null.
constant
Constant value for element data.
optional; string; Standardwert: null.
converter
Converter for element data transformation.
optional; string; Standardwert: null.
database
Database client id when source equals 'database'.
optional; string; Standardwert: null.
defaultValue
Default value for the element.
optional; string; Standardwert: null.
distribution
Sampling distribution / sequence for ranged numeric element.
optional; string; Standardwert: null; Werte: uniform, cumulated, step, increment, randomWalk, shuffle, wedge, bitreverse, fibonacci, padovan.
generator
Predefined generators for element data generation.
optional; string; Standardwert: null.
granularity
Step width of numeric grid; defaults 1 for int, 0.1 for float. On int, must be whole.
optional; string; Standardwert: null.
inDateFormat
Input date format for element data.
optional; string; Standardwert: null.
max
Maximum value for numerical generator.
optional; number; Standardwert: null.
maxLength
Maximum length for binary payload generation.
optional; integer; Standardwert: null.
mimeType
Optional MIME signature for binary payload generation.
optional; string; Standardwert: null.
min
Minimum value for numerical generator.
optional; number; Standardwert: null.
minLength
Minimum length for binary payload generation.
optional; integer; Standardwert: null.
name
Name of the element.
erforderlich; string.
nullQuota
Null quota for element data generation.
optional; number; Standardwert: null.
outDateFormat
Output date format for element data.
optional; string; Standardwert: null.
pattern
Pattern for element data generation.
optional; string; Standardwert: null.
script
Script for element data generation.
optional; string; Standardwert: null.
selector
Selector for element data generation.
optional; string; Standardwert: null.
separator
Separator for element data.
optional; string; Standardwert: null.
source
Source of data for the element.
optional; string; Standardwert: null.
string
String for the variable data generation.
optional; string; Standardwert: null.
type
Data type of the element.
optional; string; Standardwert: null; Werte: string, int, integer, float, bool, binary.
unique
Emit each value at most once (distinct picks from values, no replacement).
optional; boolean; Standardwert: null.
values
Comma-separated list of values for the element.
optional; string; Standardwert: null.
variablePrefix
Prefix before field's name for string in element generation.
optional; string; Standardwert: null.
variableSuffix
Suffix after field's name for string in element generation.
optional; string; Standardwert: null.
weights
Comma-separated relative weights, one per values entry, for weighted random selection.
optional; string; Standardwert: null.