Under this option you define the structure of the nodes within the XML file:
Work with XML nodes XML350D
XML definition name . : XML_DEMO
Position to . . . . . . Sequence number
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display 12=Field definitions
Opt SeqNbr XML path 1 /Root 2 /Root//Document 3 /Root/Document//DetailLine
End F3=Exit F6=Create F11=View 2 F12=Cancel
|
Press F6=Create to add new nodes:
Change XML node XML351D
XML definition name . . : XML_DEMO
Node sequence . . . . . . 3
XML path . . . . . . . . . /Root/Document//DetailLine
Note: Specify XML path as /rotnode/node2/node3...
To allow duplicate fields inside page segments specify a double slash (//) before the node that will be repeated when ever a field for the node is repeated.
F3=Exit F12=Cancel
|
You gradually add new nodes like shown above. Please note, that you insert the double slash for the node, that will be repeated for each value found (for a specified variable) in the spooled file.
You may only insert one double quote (//) in each sequence number.
One the overview screen of the nodes (XML350D), you can use option 12=Field definitions to link the nodes with data found in the spooled file:
Work with XML nodes XML350D
XML definition name . : XML_DEMO
Position to . . . . . . Sequence number
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display 12=Field definitions
Opt SeqNbr XML path 1 /Root 2 /Root//Document 3 /Root/Document//DetailLine
End F3=Exit F6=Create F11=View 2 F12=Cancel
|
If you have defined any variable (*V1-*V9) for the XML file/path, and you want to create a new XML file for each value found, then you need to state the root path (called /Root in the screen above) - not with a single slash, but double slash (e.g. //Root).
Via option 12=Field definitions this screen is accessed, where all existing fields for the current node is shown:
Work with field definitions XML360D
XML definition name . : XML_DEMO Sequence number . . . : 2 XML path . . . . . . : /Root//Document
Position to . . . . . . Field sequence
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display
Opt F-seq Field@Attribute Page type(s) Line type _ 1 @Company PAGE1 _ 2 DocumentNo PAGE1
End F3=Exit F6=Create F11=View 2 F12=Cancel
|
Work with field definitions XML360D
XML definition name . : XML_DEMO Sequence number . . . : 3 XML path . . . . . . : /Root/Document//DetailLine
Position to . . . . . . Field sequence
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display
Opt F-seq Field@Attribute Page type(s) Line type 1 @SEQ DETAIL 1 Product DETAIL 2 Model DETAIL 3 i-Group DETAIL 4 SN DETAIL 5 LicenseCode DETAIL
End F3=Exit F6=Create F11=View 2 F12=Cancel
|
Now you use 2=Change or F6=Create to edit or create a Field for this node as seen below.
If you want to add an attribute for a node, then you do it like shown below:
(Use sequence number=1, keep the Field blank and simply write the attribute).
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 2 XML path . . . . . . . . : /Root//Document
Field sequence . . . . . . 1 Field . . . . . . . . . . Attribute . . . . . . . . Company Description . . . . . . . Company Name
Page type(s) . . . . . . . PAGE1 Line type . . . . . . . . Use relative line . . . Y=Yes, N=No Line . . . . . . . . . . . 6 From position . . . . . . 8 To position . . . . . . . 40 Length . . . . . . . . . .
Operator . . . . . . . . . F4=List Compare value . . . . . . More... F3=Exit F4=List F12=Cancel
|
Use <Page Down> to view the second setup screen of the field/attribute:
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 2 XML path . . . . . . . . : /Root//Document
Constant . . . . . . . . .
Functions . . . . . . . .
End F3=Exit F4=List F12=Cancel
|
This above will insert the attribute ‘Company’ with the value found in the spooled file for the pages where the page type is PAGE1.
A field can be inserted like this: (Keeping the attribute blank).
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 2 XML path . . . . . . . . : /Root//Document
Field sequence . . . . . . 2 Field . . . . . . . . . . DocumentNo Attribute . . . . . . . . Description . . . . . . . Document Number
Page type(s) . . . . . . . PAGE1 Line type . . . . . . . . Use relative line . . . Y=Yes, N=No Line . . . . . . . . . . . 13 From position . . . . . . 57 To position . . . . . . . 60 Length . . . . . . . . . .
Operator . . . . . . . . . F4=List Compare value . . . . . . More... F3=Exit F4=List F12=Cancel
|
Instead of inserting data from a fixed position like above, the data for the attribute or field can also be stated in the following manners:
•By stating a line type and Use relative line = Y, then data is selected from a the line where the line type was found. If a number of lines above and/or below was specified for a line type, then the topmost line counts as line one. (Refer to line types for details).
•The Field or attribute can also be conditionally inserted with an operator and a compare value. The possible values for the operator can be listed via F4. Refer to page types for the complete list. The compare value is written without quotes.
•Instead of values found in the spooled file you can also assign a constant value to the attribute or field.
•Apart from the above you can even run up to 3 functions. They are executed from the left to the right. The final value will be the result after running all the functions. The functions are listed below.
When you specify a variable to be used either for the XML file name or as a field/attribute in the XML file, then you can use functions to calculate the final value.
The functions can be added, when editing the variables by pressing <Page Down>, where 3 fields are shown. The functions are executed in the sequence from left to right.
The possible functions are:
Function |
Description |
COMPARE DATE-DMY DATE-MDY DATE-YMD EXITPGM GENUUID KEEPNUMCHR NUMCOMMA NUMERIC RESETSEQ1 RESETSEQ2 RESETSEQ3 RMVNUMCHR SEQ1 SEQ2 SEQ3 SST-FR-NUM SST-TO-NUM TRIMLEFT |
Run compare function here (only) Date in format day, month, year Date in format month, day, year Date in format year, month, day Call exit program Generate UUID (*1) Remove all non-numeric characters Same as NUMERIC, but convert "," to "." Format value as numeric (Remove all non-num chr) Reset sequence number 1 Reset sequence number 2 Reset sequence number 3 Remove numeric characters Sequence number - 1 Sequence number - 2 Sequence number - 3 Substring from first numeric character (*1) Substring to first numeric character (exclusive) (*1) Trim text to the left |
*1: These functions are available in the XML+ Module only.
Each function is explained below.
COMPARE
Instead of running the compare as the first thing before executing these (up to 3) functions, you can decide when to do the compare by inserting this function. You can e.g. first trim the text to left before the compare like so: TRIMLEFT COMPARE
DATE-XXX
Interpret the data found as a date and include it in the XML output as YYYY-MM-DD. This function tells InterForm400, how to interpret the text found in the spooled file. If the text found in the spooled file is ‘17/01/11' and you state DATE-DMY, then the output will be ‘2011-01-17'.
EXITPGM
Call the exit program with XEXITFNC=*DATA.
GENUUID
Generate a UUID. (*XML+ Module only). A UUID is short for a Universal Unique Identifier. It generates a ramdom 128 bit data stream, which is converted into the equivalent 32 char Hex data stream. This can e.g. be used to create a unique file name.
KEEPNUMCHR
Keep only the numeric characters in the data (remove any non-numeric character).
NUMCOMMA
Same as NUMERIC, but convert “,” to “.” and vise versa.
NUMERIC
Format as numeric - remove all non-numeric characters.
You can insert up to 3 ‘counters’ in the XML file, which you can use as values for any attribute or field. The 3 ‘counters’ are called: SEQ1, SEQ2 and SEQ3. If you want to insert an increasing sequence number (Starting with ‘1'), then use this function. You can reset the value to 1 with the RESETSEQx function.
RESETSEQ1
Reset SEQ1 to “1".
RESETSEQ2
Reset SEQ2 to “1".
RESETSEQ3
Reset SEQ3 to “1".
RMVNUMCHR
Remove numeric characters.
SEQ1
Insert the value of SEQ1 in the current attribute or field.
SEQ2
Insert the value of SEQ2 in the current attribute or field.
SEQ3
Insert the value of SEQ3 in the current attribute or field.
SST-FR-NUM
Substring from first numeric character. (*XML+ Module only).
SST-TO-NUM
Substring to first numeric character (exclusive) (*XML+ Module only).
TRIMLEFT
Trim the text for any leading blanks.
In the example above we are using SEQ1 to add a sequence number as attribute for the detailline node. Here is the details:
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 3 XML path . . . . . . . . : /Root/Document//DetailLine
Field sequence . . . . . . 1 Field . . . . . . . . . . Attribute . . . . . . . . SEQ Description . . . . . . .
Page type(s) . . . . . . . Line type . . . . . . . . DETAIL Use relative line . . . N Y=Yes, N=No Line . . . . . . . . . . . From position . . . . . . To position . . . . . . . Length . . . . . . . . . .
Operator . . . . . . . . . F4=List Compare value . . . . . . More... F3=Exit F4=List F12=Cancel
|
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 3 XML path . . . . . . . . : /Root/Document//DetailLine
Constant . . . . . . . . .
Functions . . . . . . . . SEQ1
End F3=Exit F4=List F12=Cancel
|
Only thing missing is to reset the sequence number each time there is a new document number. That is done in the company attribute:
Change field definition XML361D
XML definition name . . : XML_DEMO Sequence number . . . . : 2 XML path . . . . . . . . : /Root//Document
Constant . . . . . . . . .
Functions . . . . . . . . RESETSEQ1
End F3=Exit F4=List F12=Cancel
|
The definitions made above are all intended for the InterForm400 demo spooled file, which you can print out from the InterForm400 Service Menu.
The final result of the settings done above results in an XML file named:
MyFileYour new InterForm400 modules.-2011-03-29-12.50.55.411000.xml
(Where “2011-03-29-12.50.55.411000" of course will be exchanged for the exact time stamp whenever the conversion is run).
The contents of the XML file will be like shown below. Because of the use of the PAGE1 page type only one <DocumentNo> field is shown for each value - not 2 for “1001" - even though 2 pages contain this value.