ComposantsComponents › XML
Construit un document XML à partir des colonnes du flux, selon un arbre (éléments, attributs, espaces de noms) dessiné dans l'éditeur du composant, et le range dans une colonne de sortie de type String ou Document. Sans Group by, chaque ligne entrante donne un document ; avec Group by, les lignes qui se suivent avec les mêmes valeurs forment un seul document. Pour écrire l'arbre dans un fichier, prenez un tAdvancedFileOutputXML ; pour relire des champs d'une colonne XML, un tExtractXMLField. Builds an XML document from the columns of the flow, following a tree (elements, attributes, namespaces) drawn in the component editor, and stores it in an output column of type String or Document. Without Group by, each incoming row gives a document; with Group by, the rows that follow each other with the same values form a single document. To write the tree to a file, take a tAdvancedFileOutputXML; to read fields back from an XML column, a tExtractXMLField.
EntréeInput
Main un flux, obligatoire : ses colonnes alimentent l'arbreone flow, required: its columns feed the tree
SortieOutput
Main un flux, obligatoire : une ligne par document, seule la colonne XML est remplieone flow, required: one row per document, only the XML column is filled
Déclencheurs en sortieOutput triggers
On Component Ok On Component Error Run if
Chaque document sort dans une ligne, colonne xml (String), pour être affiché, rangé en base ou envoyé plus loin.
Each document comes out in a row, xml column (String), to be displayed, stored in a database or sent further.
Avec une colonne de sortie de type Document, nommée payload, le document est celui qu'attend un tESBConsumer.
With an output column of type Document, named payload, the document is the one a tESBConsumer expects.
L'éditeur montre à gauche les colonnes du flux entrant, à droite l'arbre du document. Clic droit sur un nœud : Ajouter un sous-élément, Ajouter un attribut, Ajouter un espace de noms, Définir une valeur fixe, Définir comme élément de boucle, Définir comme élément de groupe, Importer l'arborescence XML (depuis un fichier XML ou XSD). Une colonne glissée sur un nœud s'y lie ; Auto map ! lie les nœuds aux colonnes de même nom. Le même éditeur sert au tAdvancedFileOutputXML. The editor shows on the left the columns of the incoming flow, on the right the tree of the document. Right-click on a node: Add Sub-element, Add Attribute, Add Name Space, Set a fixed value, Set As Loop Element, Set As Group Element, Import XML Tree (from an XML or XSD file). A column dragged on a node gets linked to it; Auto map! links the nodes to the columns of the same name. The same editor is used by the tAdvancedFileOutputXML.
customers
└─ customer boucleloop
├─ @id ← id
├─ name ← name
└─ city ← city
Chaque ligne du flux ajoute un élément customer. L'attribut id et les éléments name et city prennent la valeur de la colonne liée.
Each row of the flow adds a customer element. The id attribute and the name and city elements take the value of the linked column.
x:city.Namespace: a prefix (empty for the default namespace) and a value; a prefixed element is written x:city.
L'arbre est enregistré dans trois tables masquées du composant, ROOT, GROUP et LOOP : une ligne par nœud, avec son chemin (PATH), sa colonne (COLUMN), sa valeur fixe (VALUE), sa sorte (ATTRIBUTE : main, branch, attri, ns) et son rang (ORDER, qui commence à 2 sous la racine).
The tree is saved in three hidden tables of the component, ROOT, GROUP and LOOP: one row per node, with its path (PATH), its column (COLUMN), its fixed value (VALUE), its kind (ATTRIBUTE: main, branch, attri, ns) and its rank (ORDER, which starts at 2 under the root).
Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| Colonne de sortieOutput ColumnXMLFIELD | — | ToujoursAlways |
La colonne du schéma qui reçoit le document. String : le texte du document, déclaration comprise ; Document : le même texte, analysé. Les autres colonnes du schéma restent à null (voir les pièges).
The schema column that gets the document. String: the text of the document, declaration included; Document: the same text, parsed. The other schema columns stay null (see the pitfalls).
|
| Configurer l'arbre XMLConfigure XML TreeMAP | — | ToujoursAlways |
Bouton qui ouvre l'éditeur de l'arbre (voir l'arbre XML). L'arbre est rangé dans les tables masquées ROOT, GROUP et LOOP.
Button that opens the tree editor (see the XML tree). The tree is stored in the hidden tables ROOT, GROUP and LOOP.
|
| SchémaSchemaSCHEMA | — | ToujoursAlways | Le schéma de sortie, en général une seule colonne. L'arbre, lui, se lie aux colonnes du flux entrant. The output schema, usually a single column. The tree is linked to the columns of the incoming flow. |
| Group byGROUPBYS | videempty | ToujoursAlways |
Une ligne par colonne d'entrée (Colonne d'entrée). Les lignes qui se suivent avec les mêmes valeurs de ces colonnes forment un document ; un changement de valeur en commence un autre. Vide : un document par ligne entrante (voir les exemples). Une valeur null dans ces colonnes arrête le job (voir les erreurs).
One row per input column (InputColumn). The rows that follow each other with the same values of these columns form a document; a change of value starts another one. Empty: one document per incoming row (see the examples). A null value in these columns stops the job (see the errors).
|
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| Supprimer la déclaration XMLRemove the XML declarationREMOVE_HEADER | NonNo | ToujoursAlways |
Le document commence sans <?xml … ?>. En mode Dom4j, un saut de ligne reste en tête (voir les exemples).
The document starts without <?xml … ?>. In Dom4j mode, a line break remains at the start (see the examples).
|
| Créer un élément vide si nécessaireCreate empty element if neededCREATE_EMPTY_ELEMENT | OuiYes | ToujoursAlways |
Coché, un élément lié à une colonne null est écrit vide (<city/>). Décoché, il disparaît, comme tout élément resté sans contenu ni attribut (voir les exemples).
Checked, an element linked to a null column is written empty (<city/>). Unchecked, it disappears, like any element left without content or attribute (see the examples).
|
| Ignorer les attributs de service pour les éléments videsIgnore service attributes for empty elementsIGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY | NonNo | Élément vide décochéEmpty element unchecked |
Mode Dom4j. Les attributs nommés type, class ou array ne comptent pas : un élément qui n'a qu'eux est supprimé comme un élément vide (voir les exemples).
Dom4j mode. The attributes named type, class or array do not count: an element that only has them is removed like an empty element (see the examples).
|
| Développer l'élément vide si besoin (pour dom4j)Expand Empty Element if needed(for dom4j)EXPAND_EMPTY_ELM | NonNo | Élément vide cochéEmpty element checked |
Mode Dom4j : un élément vide s'écrit <city></city> au lieu de <city/>. Le mode rapide écrit toujours la forme développée.
Dom4j mode: an empty element is written <city></city> instead of <city/>. The fast mode always writes the expanded form.
|
| Crée le fichier XSD associéCreate associated XSD fileOUTPUT_AS_XSD | NonNo | ToujoursAlways |
Écrit, à la fin, un schéma XSD qui décrit l'arbre, et ajoute à la racine de chaque document xsi:noNamespaceSchemaLocation avec le chemin du fichier (voir l'exemple). Les éléments vides sont alors gardés ; d'après le modèle, un élément lié à une valeur null reçoit xsi:nil="true".
Writes, at the end, an XSD schema that describes the tree, and adds to the root of each document xsi:noNamespaceSchemaLocation with the path of the file (see the example). Empty elements are then kept; per the template, an element linked to a null value gets xsi:nil="true".
|
| Chemin d'accès au fichier XSDXSD file pathXSD_FILE | chemin par défaut + /file.xsddefault path + /file.xsd |
XSD cochéXSD checked | Le fichier XSD écrit. Son chemin est recopié tel quel dans les documents. Dans Talaxie 9.0.6, ce champ reste affiché case décochée (sa condition d'affichage a une parenthèse en trop dans la définition du composant) ; il est alors sans effet. Talaxie 9.0.7 le masque, comme le Studio. The XSD file written. Its path is copied as it is in the documents. In Talaxie 9.0.6, this field stays shown with the box unchecked (its display condition has an extra parenthesis in the component definition); it then has no effect. Talaxie 9.0.7 hides it, as the Studio does. |
| Séparateur avancé (pour les nombres)Advanced separator (for numbers)ADVANCED_SEPARATOR | NonNo | ToujoursAlways | Écrit les colonnes numériques avec les séparateurs choisis ci-dessous (voir les exemples). Writes the number columns with the separators chosen below (see the examples). |
| Séparateur de milliersThousands separatorTHOUSANDS_SEPARATOR | "," |
Séparateur avancé cochéAdvanced separator checked | Un caractère, entre guillemets.One character, in quotes. |
| Séparateur décimalDecimal separatorDECIMAL_SEPARATOR | "." |
Séparateur avancé cochéAdvanced separator checked | Un caractère, entre guillemets.One character, in quotes. |
| Mode de générationGeneration modeGENERATION_MODE | Lent et consommateur de mémoire (Dom4J)Slow and memory-consuming (Dom4J) | ToujoursAlways |
Dom4J : chaque document est construit en mémoire avec la bibliothèque dom4j, puis écrit indenté. Rapide avec peu de consommation de mémoire : le texte est écrit au fil des lignes. Les documents des exemples sont les mêmes, sauf : guillemets du texte écrits ", éléments vides toujours développés, espaces de noms mieux acceptés (voir les erreurs).
Dom4J: each document is built in memory with the dom4j library, then written indented. Fast with low memory consumption: the text is written as the rows come. The documents of the examples are the same, except: quotes of the text written ", empty elements always expanded, namespaces better accepted (see the errors).
|
| EncodageEncodingENCODING | "ISO-8859-15" |
ToujoursAlways |
Écrit seulement dans la déclaration <?xml … encoding="…"?> : la colonne est une chaîne Java, sans octets. Donnez l'encodage avec lequel le document sera enregistré ou envoyé, souvent "UTF-8".
Only written in the <?xml … encoding="…"?> declaration: the column is a Java string, without bytes. Give the encoding with which the document will be saved or sent, often "UTF-8".
|
NB_LINE (Integer, disponible après l'exécution du composant) : nombre de documents produits, c'est-à-dire de lignes sorties, et non de lignes reçues. Avec Group by sur la ville, 3 lignes reçues donnent 2. NB_LINE (Integer, available after the component has run): number of documents produced, that is of rows sent out, not of rows received. With Group by on the city, 3 received rows give 2.
((Integer) globalMap.get("tWriteXMLField_1_NB_LINE"))
Le composant est virtuel : à la génération du code, il se dédouble en deux composants techniques, tWriteXMLField_1_Out qui reçoit les lignes et construit les documents, et tWriteXMLField_1_In qui les envoie au composant suivant. Le premier range aussi le nombre de lignes reçues dans tWriteXMLField_1_Out_NB_LINE, une variable que le composant ne déclare pas ; les messages d'erreur nomment tWriteXMLField_1_Out.
The component is virtual: when the code is generated, it splits into two technical components, tWriteXMLField_1_Out which receives the rows and builds the documents, and tWriteXMLField_1_In which sends them to the next component. The first one also stores the number of received rows in tWriteXMLField_1_Out_NB_LINE, a variable the component does not declare; the error messages name tWriteXMLField_1_Out.
Un tFixedFlowInput envoie les lignes au tWriteXMLField_1, dont la colonne de sortie xml (String) est affichée par un tLogRow en mode simple ; un tJava relié par On Subjob Ok affiche les variables globales. Quand un job enchaîne plusieurs sous-jobs, un tJava affiche avant chacun une ligne === …. Les sorties sont copiées depuis des exécutions des jobs dans Talaxie (Java 21). Le tLogRow ajoute un saut de ligne après chaque document, d'où la ligne vide qui les sépare.
A tFixedFlowInput sends the rows to tWriteXMLField_1, whose xml output column (String) is printed by a tLogRow in basic mode; a tJava connected with On Subjob Ok prints the global variables. When a job chains several subjobs, a tJava prints a === … line before each one. The outputs are copied from runs of the jobs in Talaxie (Java 21). The tLogRow adds a line break after each document, hence the empty line between them.
| idInteger | nameString | cityString |
|---|---|---|
| 1 | Ada | London |
| 2 | Alan | London |
| 3 | Grace | New York |
Arbre de la section précédente, tous les réglages par défaut. Code du tJava_1 : Tree of the section above, all settings by default. tJava_1 code:
System.out.println("tWriteXMLField_1_NB_LINE: " + globalMap.get("tWriteXMLField_1_NB_LINE"));
System.out.println("tWriteXMLField_1_Out_NB_LINE: " + globalMap.get("tWriteXMLField_1_Out_NB_LINE"));
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers>
<customer id="1">
<name>Ada</name>
<city>London</city>
</customer>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers>
<customer id="2">
<name>Alan</name>
<city>London</city>
</customer>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers>
<customer id="3">
<name>Grace</name>
<city>New York</city>
</customer>
</customers>
tWriteXMLField_1_NB_LINE: 3
tWriteXMLField_1_Out_NB_LINE: 3
Trois lignes, trois documents complets, chacun avec sa déclaration suivie d'une ligne vide, puis indenté de deux espaces. L'élément de boucle n'apparaît qu'une fois par document. Three rows, three whole documents, each with its declaration followed by an empty line, then indented by two spaces. The loop element only appears once per document.
Mêmes lignes. Group by : city. Arbre : attribut city sur la racine, élément customer en boucle avec l'attribut id et l'élément name.
Same rows. Group by: city. Tree: city attribute on the root, customer loop element with the id attribute and the name element.
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers city="London">
<customer id="1">
<name>Ada</name>
</customer>
<customer id="2">
<name>Alan</name>
</customer>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers city="New York">
<customer id="3">
<name>Grace</name>
</customer>
</customers>
tWriteXMLField_1_NB_LINE: 2
tWriteXMLField_1_Out_NB_LINE: 3
Les nœuds hors de la boucle (ici l'attribut de la racine) prennent les valeurs de la première ligne du document. Avec les lignes dans l'ordre London, New York, London, le job a sorti trois documents, dont deux London (NB_LINE : 3) : triez d'abord le flux sur les colonnes de Group by.
The nodes outside the loop (here the attribute of the root) take the values of the first row of the document. With the rows in the order London, New York, London, the job sent out three documents, two of them London (NB_LINE: 3): sort the flow on the Group by columns first.
Lignes country|city|id|name : UK|London|1|Ada, UK|London|2|Alan, UK|Manchester|3|Tom, US|Boston|4|Margaret, US|New York|5|Grace. Group by : country. Arbre : customers (attribut country) › city en élément de groupe (attribut name ← city) › customer en boucle.
Rows country|city|id|name: UK|London|1|Ada, UK|London|2|Alan, UK|Manchester|3|Tom, US|Boston|4|Margaret, US|New York|5|Grace. Group by: country. Tree: customers (country attribute) › city as group element (name attribute ← city) › customer as loop.
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers country="UK">
<city name="London">
<customer id="1">
<name>Ada</name>
</customer>
<customer id="2">
<name>Alan</name>
</customer>
</city>
<city name="Manchester">
<customer id="3">
<name>Tom</name>
</customer>
</city>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers country="US">
<city name="Boston">
<customer id="4">
<name>Margaret</name>
</customer>
</city>
<city name="New York">
<customer id="5">
<name>Grace</name>
</customer>
</city>
</customers>
tWriteXMLField_1_NB_LINE: 2
Group by délimite les documents, l'élément de groupe range les lignes à l'intérieur de chacun. Sans Group by, le même arbre a donné un document par ligne, chacun avec un seul city.
Group by delimits the documents, the group element arranges the rows inside each one. Without Group by, the same tree gave one document per row, each with a single city.
Ligne 1|Ada|London. Sur la racine, un espace de noms par défaut (préfixe vide, http://example.com/crm) ; dans un second job, un espace de noms x (http://example.com/extra) et l'élément renommé x:city. Mode Dom4j :
Row 1|Ada|London. On the root, a default namespace (empty prefix, http://example.com/crm); in a second job, an x namespace (http://example.com/extra) and the element renamed x:city. Dom4j mode:
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers xmlns="http://example.com/crm">
<customer id="1">
<name>Ada</name>
<city>London</city>
</customer>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers xmlns:x="http://example.com/extra">
<customer id="1">
<name>Ada</name>
<x:city>London</x:city>
</customer>
</customers>
Les éléments sans préfixe héritent de l'espace par défaut de la racine. Le mode rapide a donné les mêmes documents. Les deux à la fois ne passent qu'en mode rapide (voir les erreurs). The elements without a prefix inherit the default namespace of the root. The fast mode gave the same documents. Both at once only work in fast mode (see the errors).
Ligne 2|Alan|null, arbre des exemples, trois sous-jobs : réglages par défaut, Créer un élément vide si nécessaire décoché, puis Développer l'élément vide coché (seul le second document est recopié) :
Row 2|Alan|null, tree of the examples, three subjobs: default settings, Create empty element if needed unchecked, then Expand Empty Element checked (only the second document is copied):
=== default
…
<customers>
<customer id="2">
<name>Alan</name>
<city/>
</customer>
</customers>
=== CREATE_EMPTY_ELEMENT false
…
<customers>
<customer id="2">
<name>Alan</name>
</customer>
</customers>
=== EXPAND_EMPTY_ELM true
…
<customers>
<customer id="2">
<name>Alan</name>
<city></city>
</customer>
</customers>
Le mode rapide écrit <city></city> par défaut, et retire l'élément de la même façon quand la case est décochée. Avec un attribut fixe type="string" sur city et la case décochée :
The fast mode writes <city></city> by default, and removes the element the same way when the box is unchecked. With a fixed type="string" attribute on city and the box unchecked:
=== IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY false
…
<name>Alan</name>
<city type="string"/>
</customer>
…
=== IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY true
…
<name>Alan</name>
</customer>
…
Ligne 1|Café|1234567.50, la dernière colonne amount en BigDecimal. Premier sous-job : Supprimer la déclaration XML. Second : Encodage "UTF-8", Séparateur avancé avec "." pour les milliers et "," pour les décimales.
Row 1|Café|1234567.50, the last column amount as BigDecimal. First subjob: Remove the XML declaration. Second one: Encoding "UTF-8", Advanced separator with "." for thousands and "," for decimals.
=== REMOVE_HEADER true
<customers>
<customer id="1">
<name>Café</name>
<amount>1234567.50</amount>
</customer>
</customers>
=== ENCODING UTF-8, ADVANCED_SEPARATOR
<?xml version="1.0" encoding="UTF-8"?>
<customers>
<customer id="1">
<name>Café</name>
<amount>1.234.567,50</amount>
</customer>
</customers>
Sans déclaration, le document commence par un saut de ligne. L'encodage ne change que la déclaration : é reste un caractère de la chaîne.
Without the declaration, the document starts with a line break. The encoding only changes the declaration: é stays a character of the string.
Attribut source de la racine fixé à crm, élément status fixé à active. Ligne : name = Tom & "Jerry", city = <![CDATA[<b>bold</b>]]>. Modes Dom4j puis rapide :
source attribute of the root fixed to crm, status element fixed to active. Row: name = Tom & "Jerry", city = <![CDATA[<b>bold</b>]]>. Dom4j then fast mode:
=== Dom4j
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers source="crm">
<customer id="1">
<name>Tom & "Jerry"</name>
<city><![CDATA[<b>bold</b>]]></city>
<status>active</status>
</customer>
</customers>
=== Null
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers source="crm">
<customer id="1">
<name>Tom & "Jerry"</name>
<city><![CDATA[<b>bold</b>]]></city>
<status>active</status>
</customer>
</customers>
Une valeur entre <![CDATA[ et ]]> est écrite en section CDATA, sans échappement. Les nœuds à valeur fixe sont écrits dans chaque document, quelle que soit la ligne.
A value between <![CDATA[ and ]]> is written as a CDATA section, without escaping. The fixed nodes are written in each document, whatever the row.
Trois lignes des exemples, Group by city, colonne de sortie xml de type Document. Le tExtractXMLField boucle sur "/customers/customer" : id ← "@id", name ← "name", city ← "../@city".
Three rows of the examples, Group by city, xml output column of type Document. The tExtractXMLField loops on "/customers/customer": id ← "@id", name ← "name", city ← "../@city".
.--+-----+--------. | tLogRow_1 | |=-+-----+-------=| |id|name |city | |=-+-----+-------=| |1 |Ada |London | |2 |Alan |London | |3 |Grace|New York| '--+-----+--------' tWriteXMLField_1_NB_LINE: 2 tExtractXMLField_1_NB_LINE: 3
Ligne 1|Ada|London, arbre des exemples, Crée le fichier XSD associé coché, chemin "C:/data/w/customers.xsd". Le tJava affiche ensuite le fichier :
Row 1|Ada|London, tree of the examples, Create associated XSD file checked, path "C:/data/w/customers.xsd". The tJava then prints the file:
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/data/w/customers.xsd">
<customer id="1">
<name>Ada</name>
<city>London</city>
</customer>
</customers>
--- w/customers.xsd
<?xml version="1.0" encoding="ISO-8859-15"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="customers" nillable="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="customer" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="city" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="id"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Le schéma décrit la forme de l'arbre seulement : pas de types, tout élément facultatif et répétable. Le chemin est écrit tel quel dans xsi:noNamespaceSchemaLocation (le dossier de travail est remplacé ici par C:/data).
The schema only describes the shape of the tree: no types, every element optional and repeatable. The path is written as it is in xsi:noNamespaceSchemaLocation (the working folder is replaced here with C:/data).
Mêmes jobs que dans les exemples. Le nom du job est remplacé par MyJob et les traces d'exception sont abrégées. Les messages des NullPointerException sont ceux de Java 21 : une version plus ancienne de Java en écrit un plus court.
Same jobs as in the examples. The job name is replaced with MyJob and the exception traces are shortened. The messages of the NullPointerException are those of Java 21: an older Java version writes a shorter one.
Group by city, lignes 1|Ada|London et 2|Alan|null : le job s'arrête (code 1).
Group by city, rows 1|Ada|London and 2|Alan|null: the job stops (exit code 1).
Exception in component tWriteXMLField_1_Out (MyJob) java.lang.NullPointerException: Cannot invoke "String.length()" because the return value of "java.util.Map.get(Object)" is null at …MyJob.tFixedFlowInput_1Process(MyJob.java:1095) …
Le code généré mesure la longueur de chaque valeur de Group by sans tester null (défaut du modèle tWriteXMLFieldOut_main.javajet). Remplacez les null avant le composant, par exemple dans un tMap : row1.city == null ? "" : row1.city.
The generated code measures the length of each Group by value without testing null (defect of the tWriteXMLFieldOut_main.javajet template). Replace the null values before the component, for example in a tMap: row1.city == null ? "" : row1.city.
Sur la racine, l'espace de noms par défaut et l'espace x ; élément x:city. Mode Dom4j (défaut) : le job s'arrête.
On the root, the default namespace and the x namespace; x:city element. Dom4j mode (default): the job stops.
Exception in component tWriteXMLField_1_Out (MyJob) java.lang.IllegalArgumentException: Illegal character in local name: 'x:city'. at org.dom4j.QName.validateNCName(QName.java:346) … at …MyJob$1NestXMLTool_tWriteXMLField_1_Out.replaceDefaultNameSpace(MyJob.java:876) …
Le modèle renomme l'élément en x:city comme un nom local, puis lui applique l'espace par défaut, que dom4j 2.1.3 refuse. Chacun des deux espaces seul fonctionne (voir l'exemple), et le mode rapide accepte les deux :
The template renames the element to x:city as a local name, then applies the default namespace to it, which dom4j 2.1.3 refuses. Each of the two namespaces alone works (see the example), and the fast mode accepts both:
<customers xmlns="http://example.com/crm" xmlns:x="http://example.com/extra">
<customer id="1">
<name>Ada</name>
<x:city>London</x:city>
</customer>
</customers>
Schéma de sortie xml, city ; Group by city. Un tJavaRow affiche chaque valeur entre crochets, sauts de ligne visibles :
Output schema xml, city; Group by city. A tJavaRow prints each value in brackets, line breaks visible:
xml=[<?xml version="1.0" encoding="ISO-8859-15"?>\n\n<customers city="London">\n <customer id="1">\n <name>Ada</name>\n </customer>\n <customer id="2">\n <name>Alan</name>\n </customer>\n</customers>\n] city=[null] xml=[<?xml version="1.0" encoding="ISO-8859-15"?>\n\n<customers city="New York">\n <customer id="3">\n <name>Grace</name>\n </customer>\n</customers>\n] city=[null]
Seule la colonne XML est remplie, même pour une colonne de Group by du même nom. Pour garder la clé du document, relisez-la dans le XML (tExtractXMLField, "/customers/@city").
Only the XML column is filled, even for a Group by column of the same name. To keep the key of the document, read it back from the XML (tExtractXMLField, "/customers/@city").
L'arbre de l'exemple avec un élément de groupe, Group by laissé vide, lignes UK|London|1|Ada, UK|London|2|Alan, UK|Manchester|3|Tom :
The tree of the example with a group element, Group by left empty, rows UK|London|1|Ada, UK|London|2|Alan, UK|Manchester|3|Tom:
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers country="UK">
<city name="London">
<customer id="1">
<name>Ada</name>
</customer>
</city>
</customers>
<?xml version="1.0" encoding="ISO-8859-15"?>
<customers country="UK">
<city name="London">
<customer id="2">
…
tWriteXMLField_1_NB_LINE: 3
Un document par ligne : l'élément de groupe ne regroupe rien tant que Group by ne réunit pas les lignes dans un même document. Pour mettre toutes les lignes dans un document, groupez sur une colonne qui a partout la même valeur. One document per row: the group element groups nothing as long as Group by does not gather the rows in the same document. To put all the rows in one document, group on a column that has the same value everywhere.
Un document n'est envoyé qu'à l'arrivée de la ligne qui commence le suivant, ou à la fin du flux. Les composants placés après le tWriteXMLField tournent dans un autre fil d'exécution (thread) que ceux d'avant : leurs messages peuvent s'entremêler dans la console. A document is only sent when the row that starts the next one arrives, or at the end of the flow. The components placed after the tWriteXMLField run in another thread than those before it: their messages may get mixed in the console.
Pour un seul fichier avec toutes les lignes, le tAdvancedFileOutputXML prend le même arbre sans Group by. Pour un document par ligne enregistré tel quel, envoyez la colonne Document à un tFileOutputXML (L'enregistrement entrant est un document). For a single file with all the rows, the tAdvancedFileOutputXML takes the same tree without Group by. For one document per row saved as it is, send the Document column to a tFileOutputXML (Incoming record is a document).
Les documents se terminent par \n. En mode rapide, sous Windows, les deux dernières lignes du dernier document finissent par \r\n : ce document est écrit par la fin du composant, qui utilise la fin de ligne du système. Sans effet pour un lecteur XML ; à savoir si les documents sont comparés au texte près.
The documents end with \n. In fast mode, on Windows, the last two lines of the last document end with \r\n: this document is written by the end of the component, which uses the system line end. No effect for an XML reader; worth knowing if the documents are compared to the exact text.
D'après le modèle, une colonne Date est écrite avec le modèle de date de son schéma, ou par toString() de Java si elle n'en a pas (en anglais, avec le fuseau de la machine) ; une colonne BigDecimal par toPlainString() ; une colonne liée de type Object est insérée comme du XML, pas comme du texte.
Per the template, a Date column is written with the date pattern of its schema, or by the Java toString() if it has none (in English, with the time zone of the machine); a BigDecimal column by toPlainString(); a linked column of type Object is inserted as XML, not as text.
tAdvancedFileOutputXML · le même arbre, écrit dans un fichierthe same tree, written to a filetExtractXMLField · lire des champs dans une colonne XMLread fields from an XML columntXMLMap · construire et transformer des documents dans un éditeur de correspondancesbuild and transform documents in a mapping editortFileOutputXML · écrire des lignes ou des documents dans un fichierwrite rows or documents to a filetXSDValidator · valider un document contre un schéma XSDvalidate a document against an XSD schematESBConsumer · envoyer le document à un service websend the document to a web service