Show last authors
1 == **__Introduction:__** ==
2
3 This connector is used to transform a file. It is a connector allowing to transform a file of another format (CSV, PLAT, - EDIFACT...) to an XML file based using a file called «  **format  **».
4
5
6 == **__Icon:__** ==
7
8
9 [[image:1646134524824-934.png||height="112" width="126"]]
10
11
12 The connector exists in the scenario panel:
13
14 [[image:1.png]]
15
16 == **__Configuration:__** ==
17
18
19 [[image:1646134567096-508.png]]
20
21
22
23 - __//Configuration ~://__
24
25 FILE_TO_XML is a transformation connector used to set up the connector, you should click on the blue button above the connector and fill in the properties displayed :
26
27 * //**Name **//: To give a name to the processing step (connector). It is very useful to give meaningful names .
28 * //**Format **//: The XML file allowing to transform the input or output file to XML format or vice versa.  We have several existing standard formats (EDIFACT, X12..)
29 * //**FileName **//: To give a name to the output file of the current step. This step is very useful for the monitoring of the platform.
30 * **//Input & Output Charset//** : to precise the encoding for the files. The default encoding is UTF-8.
31 * **//Condition //**: This field allows you to add a condition to execute the processing step only if the condition is met.
32 * //**Add boundary OnError**// : It is checked only to add an additional treatment in the case of an error on the treatment step.
33
34 == __**Le fichier Format:**__ ==
35
36
37 The format file is mandatory for the connector to work. The iXPath file formats are described in XML and stored in the client environment's format directory.
38
39 The XML format represents the actual hierarchical structure of the temporary format file.
40
41 The XML output file will strictly use the tag names and structure defined in the format structure file.
42
43 In this chapter we will go through all the possible cases of the format file.
44
45 1. (((
46 ==== __**Format Edifact**__ ====
47 )))
48
49 //__**Introduction:**__//
50
51 The Edifact format allows the user to transform an edifact file to an xml file respecting the standard format. There are so many platforms that validate the structured files.
52
53 XML documents must contain one root element that is the parent of all other elements. This element should exist once in all the document. In general it is a node called "ixDOC".
54
55
56 __//**Elements of the file format:**//__
57
58 Any group of information (even those that are not delimited by characters, a line break or other) must be represented in the document (e.g. groups of EDIFACT segments, Messages, etc.).
59
60
61 **~ Attributes **are considered one of the important elements in the format xml file. They tell the translation processor what actions to take when reading the document. They should be defined globally in the root element or individually on each tag.
62
63
64 All the attributes defined in the root tag will be automatically carried over to all the tags in the format. These are therefore the default attributes. An undefined attribute will take the default value defined in the document.
65
66 Each attribute should be indicated only if it is really useful. Some attributes can slow down the processing.
67
68
69 (% class="table-bordered" %)
70 (% class="active" %)|(% colspan="2" %)(((
71 ====== __**List of Processing Attributes:**__ ======
72 )))
73 |(((
74 **format**
75
76 //string//
77 )))|(((
78 **Default Value : **«** **none »
79
80 **Description : **Defines how the data will be taken from the file
81
82 * **« none » :** Defines a group of information, not delimited.
83 * **« variable » :**Data delimited by one or more characters. The "end" attribute is mandatory for this format.
84 * **« fixed » :**Fixed size data. The « length » attribute is mandatory.
85 )))
86 |(((
87 **end**
88
89 //string//
90 )))|(((
91 **Default Value : **empty
92
93 **Description :** Defines the character or characters delimiting a variable format. The characters " \r " (carriage return) " \n " (newline) " \t " (tab), can be used.
94 )))
95 |(((
96 **length**
97
98 //integer//
99 )))|(((
100 **Default Value : **empty
101
102 **Description :** Defines the number of characters to be taken for a structure of type "fixed".
103 )))
104 |(((
105 **min**
106
107 //integer//
108 )))|(((
109 **Default Value : **0
110
111 **Description : **Defines the minimum number of successive occurrences of this tag. If min="1", it means that the tag is mandatory and should exist in the output file.
112 )))
113 |(((
114 **max**
115
116 //integer//
117 )))|(((
118 **Default Value : **1
119
120 **Description : **Defines the maximum number of successive occurrences of this tag. The character "n" can be used to indicate that the tag could be repeated without a max limit.
121 )))
122 |(((
123 **doRead**
124
125 //boolean//
126 )))|(((
127 **Default Value : **true
128
129 **Description : **Used for reading only. Defines whether the XML tag should be written to the output XML file. Not writing a tag frees up memory and speeds up processing. It becomes essential to use this attribute to process big sized files (**≈ **Mo).
130 )))
131 |(((
132 **skipEmpty**
133
134 //boolean//
135 )))|(((
136 **Default Value : **true
137
138 **Description : **Used for reading only. Defines if an empty XML tag should be generated if the data is empty in the source file.
139 )))
140 |(((
141 **errorLevel**
142
143 //boolean//
144 )))|(((
145 **Default Value : **false
146
147 **Description : **When this attribute is set to "true", the translator will make a copy of the reading point. In case of error, the first characters will be returned in the error message. It is advisable to set this attribute to " true " on the records or segments.
148 )))
149 |(((
150 **key**
151
152 //boolean//
153 )))|(((
154 **Default Value : **false
155
156 **Description : **Defines if the data is a key for its parent. The data must be identical to the value inside the tag described in the format.
157 )))
158 |(((
159 **dataPick**
160
161 //boolean//
162 )))|(((
163 **Default Value : **true
164
165 **Description : **For the "fixed" format only. It defines if the data is really taken.
166 )))
167 |(((
168 **emptyEnd**
169
170 //boolean//
171 )))|(((
172 **Default Value : **false (if the tag has children) - true (if the tag has no children)
173
174 **Description : **Defines whether the end separator for a variable format should be written if the data is empty.
175 )))
176 |(((
177 **lastEnd**
178
179 //boolean//
180 )))|(((
181 **Default Value : **true
182
183 **Description : **Defines whether the end separator for a variable format should be written if the data is the last in a sequence.
184 )))
185 |(((
186 **optionChar**
187
188 //string//
189 )))|(((
190 **Default Value** : empty
191
192 **Description : **For a fixed format, this attribute defines one or more characters that will be taken beyond the size initially planned. This attribute is particularly useful to manage optional line breaks (case of UNA in an EDIFACT message).
193 )))
194
195 (% class="table-bordered" %)
196 (% class="active" %)|(% colspan="2" %)(((
197 ====== __**Lists of Formatting Attributes:**__ ======
198 )))
199 |(((
200 **minSize**
201
202 //integer//
203 )))|(((
204 **Default Value : **0
205
206 **Description : **Defines the minimum size of the data to be read.
207 )))
208 |(((
209 **maxSize**
210
211 //integer//
212 )))|(((
213 **Default Value : **2099999999
214
215 **Description : **Defines the maximum size of the data to be read.
216 )))
217 |(((
218 **numeric**
219
220 //boolean//
221 )))|(((
222 **Default Value : **false
223
224 **Description : **Defines if the field is numeric. For the fixed format, the value will be formatted with zeros on the left. For the variable format, the value will be formatted according to the minimum size.
225 )))
226 |(((
227 **relChar**
228
229 //string//
230 )))|(((
231 **Default Value : **empty
232
233 **Description : **Defines an escape character, especially when the string to be sampled, contains a character that uses a reserved character in the format file.
234
235 **Example :** We will use the escape character "?" to write/read the following segment NAD+BY++L?'Oreal' because ' is a character reserved in the format file and "L'Oreal" is a string that uses the ' character.
236 )))
237 |(((
238 **trim**
239
240 //integer//
241 )))|(((
242 **Default Value : **true
243
244 **Description : **Removes spaces before and after the retrieved data
245 )))
246 |(((
247 **setAttribute**
248
249 //string//
250 )))|(((
251 **Default Value : **empty
252
253 **Description : **The collected data will be stored in the named variable. This variable can then be reused in the following attributes by using the prefix "$". This allows to have a dynamic structure (like in EDIFACT where the separators are defined in the UNA).
254 )))
255 |(((
256 **alignAlpha**
257
258 //string//
259 )))|(((
260 **Default Value : **left
261
262 **Description : **Used for writing only. Defines the alignment of a character string (not numeric). Possible values are " left " and " right ".
263 )))
264 |(((
265 **fillAlpha**
266
267 //string//
268 )))|(((
269 **Default Value : **«  »  (espace)
270
271 **Description : **Defines the character used to complete a text whose size is less than the minimum size (defined by "minSize" or "length")
272 )))
273
274 (% class="table-bordered" %)
275 (% class="active" %)|(% colspan="2" %)(((
276 ====== __**List of Log Attributes: **__ ======
277 )))
278 |(((
279 **logLevel**
280
281 //string//
282 )))|(((
283 **Default Value : **empty
284
285 **Description : **Creates an object in the tracking (of the attribute name), for each occurrence of this tag (read). Several objects can be defined, separated by ";". It is possible to have sub-objects: "Object.SubObject".
286
287 **Example :** « Message », « Message;Toto », « Message.Ligne »
288 )))
289 |(((
290 **logLevelKey**
291
292 //string//
293 )))|(((
294 **Default Value : **empty
295
296 **Description : **Defines the name of a tracking field used to group multiple records in a single message. This is useful for single record files. Multiple fields can be defined by separating them with ";".
297
298 **Example : **« Message.DocNumber »
299 )))
300 |(((
301 **logTracking**
302
303 //string//
304 )))|(((
305 **Default Value : **empty
306
307 **Description : **Feeds a tracking area for the provided object type. The syntax is « Objet.NomZone ».
308
309 **Example :** « Message.DocNumber;Message.TrackingNumber;Message.Ligne.LineID»
310 )))
311
312
313 == __**Example:**__ ==
314
315
316 You will find in this part an example of an input file with the correct format and the output file.
317
318 //__**Input file:**__//
319
320 {{{UNA:+.? '
321 UNB+UNOC:3+30166749103:14+37630394010:14+211011:1644+0000001'
322 UNH+1+FORMAT:A:12C:UN:EAN006'
323 BGM+351+LIVR0211000636+9'
324 DTM+137:20211011:102'
325 DTM+2:20211005:102'
326 DTM+11:20211011:102'
327 DTM+76:20211014:102'
328 RFF+DQ:LIVR0211000636'
329 DTM+171:20211014:102'
330 RFF+ON:5255H21417C3ACHE204'
331 DTM+171:20211001:102'
332 UNT+25+1'
333 UNZ+1+0000001'}}}
334
335
336 //__**Format File:**__//
337
338 {{{<?xml version="1.0" encoding="windows-1250"?>
339 <ixDOC format="variable" min="0" max="1" subChar=":" dataChar="+" numChar="." relChar="?" repChar=" " segChar="'" emptyEnd="true" lastEnd="false" optionChar="\n\r">
340
341 <UNA format="fixed" length="9" optionChar="\r\n" min="0" max="1" errorLevel="true">
342 <TAG format="fixed" key="true" length="3" min="1">UNA</TAG>
343 <SubChar format="fixed" setAttribute="subChar" length="1"/>
344 <DataChar format="fixed" setAttribute="dataChar" length="1"/>
345 <NumChar format="fixed" setAttribute="numChar" length="1"/>
346 <RelChar format="fixed" setAttribute="relChar" length="1"/>
347 <RepChar format="fixed" setAttribute="repChar" length="1"/>
348 <SegChar format="fixed" setAttribute="segChar" length="1" trim="false" optionChar="\r\n"/>
349 </UNA>
350
351 <INTERCHANGE format="none" min="1" max="1">
352
353 <UNB end="$segChar" lastEnd="true" emptyEnd="false" min="1" max="1" optionChar="\r\n" errorLevel="true">
354 <TAG end="$dataChar" min="1" key="true">UNB</TAG>
355 <S001 end="$dataChar" min="1">
356 <D0001 end="$subChar" min="1" minSize="4" maxSize="4"/>
357 <D0002 end="$subChar" min="1" minSize="1" maxSize="1"/>
358 <D0080 end="$subChar" min="0" maxSize="6"/>
359 <D0133 end="$subChar" min="0" maxSize="3"/>
360 </S001>
361 <S002 end="$dataChar" min="1">
362 <D0004 end="$subChar" min="1" maxSize="35"/>
363 <D0007 end="$subChar" min="0" maxSize="4"/>
364 <D0008 end="$subChar" min="0" maxSize="35"/>
365 <D0042 end="$subChar" min="0" maxSize="35"/>
366 </S002>
367 <S003 end="$dataChar" min="1">
368 <D0010 end="$subChar" min="1" maxSize="35"/>
369 <D0007 end="$subChar" min="0" maxSize="4"/>
370 <D0014 end="$subChar" min="0" maxSize="35"/>
371 <D0046 end="$subChar" min="0" maxSize="35"/>
372 </S003>
373 <S004 end="$dataChar" min="1">
374 <D0017 end="$subChar" min="1" minSize="6" maxSize="6" numeric="true"/>
375 <D0019 end="$subChar" min="1" minSize="4" maxSize="4" numeric="true"/>
376 </S004>
377 <D0020 end="$dataChar" min="1" maxSize="14"/>
378 <S0005 end="$dataChar">
379 <D0022 end="$subChar" min="1" maxSize="14"/>
380 <D0025 end="$subChar" min="0" minSize="2" maxSize="2"/>
381 </S0005>
382 <D0026 end="$dataChar" maxSize="14"/>
383 <D0029 end="$dataChar" minSize="1" maxSize="1"/>
384 <D0031 end="$dataChar" minSize="1" maxSize="1" numeric="true"/>
385 <D0032 end="$dataChar" maxSize="35"/>
386 <D0035 end="$dataChar" minSize="1" maxSize="1" numeric="true"/>
387 </UNB>
388 <MESSAGE format="none" min="0" max="n">
389
390 <UNH end="$segChar" lastEnd="true" emptyEnd="false" min="1" max="1" optionChar="\r\n" errorLevel="true">
391 <TAG end="$dataChar" key="true" min="1">UNH</TAG>
392 <D0062 end="$dataChar" min="1" maxSize="14"/>
393 <S009 end="$dataChar" min="1">
394 <D0065 end="$subChar" min="1" maxSize="6"/>
395 <D0052 end="$subChar" min="1" maxSize="3"/>
396 <D0054 end="$subChar" min="1" maxSize="3"/>
397 <D0051 end="$subChar" min="1" maxSize="2"/>
398 <D0057 end="$subChar" min="0" maxSize="6"/>
399 </S009>
400 <D0068 end="$dataChar" min="0" maxSize="35"/>
401 <S010 end="$dataChar" min="0">
402 <D0070 end="$subChar" min="1" maxSize="2" numeric="true"/>
403 <D0073 end="$subChar" min="0" maxSize="1"/>
404 </S010>
405 </UNH>
406
407 <BGM end="$segChar" lastEnd="true" emptyEnd="false" min="1" max="1" optionChar="\r\n" errorLevel="true">
408 <TAG end="$dataChar" key="true" min="1">BGM</TAG>
409 <C002 end="$dataChar" min="0">
410 <D1001 end="$subChar" min="0" maxSize="3"/>
411 <D1131 end="$subChar" min="0" maxSize="3"/>
412 <D3055 end="$subChar" min="0" maxSize="3"/>
413 <D1000 end="$subChar" min="0" maxSize="35"/>
414 </C002>
415 <D1004 end="$dataChar" min="0" maxSize="35"/>
416 <D1225 end="$dataChar" min="0" maxSize="3"/>
417 <D4343 end="$dataChar" min="0" maxSize="3"/>
418 </BGM>
419
420 <DTM end="$segChar" lastEnd="true" emptyEnd="false" min="0" max="10" optionChar="\r\n" errorLevel="true">
421 <TAG end="$dataChar" key="true" min="1">DTM</TAG>
422 <C507 end="$dataChar" min="1">
423 <D2005 end="$subChar" min="1" maxSize="3"/>
424 <D2380 end="$subChar" min="0" maxSize="35"/>
425 <D2379 end="$subChar" min="0" maxSize="3"/>
426 </C507>
427 </DTM>
428
429 <SG1 min="0" max="10" format="none">
430
431 <RFF end="$segChar" lastEnd="true" emptyEnd="false" min="1" max="1" optionChar="\r\n" errorLevel="true">
432 <TAG end="$dataChar" key="true" min="1">RFF</TAG>
433 <C506 end="$dataChar" min="1">
434 <D1153 end="$subChar" min="1" maxSize="3"/>
435 <D1154 end="$subChar" min="0" maxSize="35"/>
436 <D1156 end="$subChar" min="0" maxSize="6"/>
437 <D4000 end="$subChar" min="0" maxSize="35"/>
438 </C506>
439 </RFF>
440
441 <DTM end="$segChar" lastEnd="true" emptyEnd="false" min="0" max="1" optionChar="\r\n" errorLevel="true">
442 <TAG end="$dataChar" key="true" min="1">DTM</TAG>
443 <C507 end="$dataChar" min="1">
444 <D2005 end="$subChar" min="1" maxSize="3"/>
445 <D2380 end="$subChar" min="0" maxSize="35"/>
446 <D2379 end="$subChar" min="0" maxSize="3"/>
447 </C507>
448 </DTM>
449 </SG1>
450
451 <UNT end="$segChar" lastEnd="true" emptyEnd="false" min="1" max="1" optionChar="\r\n" errorLevel="true">
452 <TAG end="$dataChar" key="true" min="1">UNT</TAG>
453 <D0074 end="$dataChar" min="1" maxSize="6" numeric="true"/>
454 <D0062 end="$dataChar" min="1" maxSize="14"/>
455 </UNT>
456 </MESSAGE>
457
458 <UNZ end="$segChar" lastEnd="true" emptyEnd="false" min="1" optionChar="\r\n" errorLevel="true">
459 <TAG end="$dataChar" key="true" min="1">UNZ</TAG>
460 <D0036 end="$dataChar" min="1" maxSize="6" numeric="true"/>
461 <D0020 end="$dataChar" min="1" maxSize="14"/>
462 </UNZ>
463 </INTERCHANGE>
464 </ixDOC>
465 }}}
466
467
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian