Section - 2 : ImportXMLFile
Use this form set rule (level 2) to import an XML file which specifies a Documaker Server document layout. The XML document must conform to the Documaker Standard XML format.
Note: Importing an XML document in this manner does not let you map additional XML information other than that specified in the Documaker Standard XML format.
Syntax
;ImportXMLFile;;option;
There are several ways to specify the import file in the option parameter:
Option | Description |
---|---|
FILE | Enter the name and path of the import file. |
INI | Enter the INI control group and option in which the import file is defined. Separate the control group and option with a comma. |
SCH | Enter the search criteria and the file name data, separated by a space. The name of the file, including its path, that you want to import should be contained in the record in the file indicated by the ExtrFile option in the Data control group. The search criteria are one or more comma delimited data pairs, offsets and character string, used as the search mask for finding the record in the specified file. The file name data is a comma delimited data pair that defines the offset and length of the file name in the record defined by the search criteria parameter. |
GVM | Enter the global variable name (GVM) that contains the file name and path information. |
Keep in mind:
-
Create a simplified AFGJOB.JDT file when you use this rule. For instance, omit these rules:
-
LoadRcpTbl
-
LoadExtractData
-
RunSetRcpTbl
-
CreateGlbVar
-
LoadDDTDefs
-
InitOvFlw
-
SetOvFlwSym
-
ResetOvFlw
Note: For information on these and other rules, see the Rules Reference.
-
-
Use the NoGenTrnTransactionProc rule because the XML file has no transaction information on the first line.
-
Place the ImportXMLExtract rule in the Base Form Set Rules section of the AFGJOB.JDT file after the BuildFormList rule or any custom rule that creates a form set.
-
In the TRN_File control group, set MaxExtRecLen option to the length of the longest record in the import file.
-
In the TRN_Fields control group, include only the Key1, Key2, and KeyID options. Set these options to dummy data, because the GVM variables are set to the data values in the XMLTags2GVM control group during processing.
-
Define the XMLTags2GVM control group in your FSISYS.INI file as shown here:
< XMLTags2GVM >
GVM = XMLTag, (Req/Opt)
Where GVM is the name of the GVM variable and XMLTag is the tag name in the XML file. Include Req or Opt to specify required or optional. If it is required and is not present in the XML file, processing terminates. Here is an example:
< XMLTags2GVM >
Key1 = Key1, Req
Key2 = Key2, Req
KeyID = TransactionID, Opt
Example
These examples show the different ways you can define the import file when you use this rule. Assume you have the following items defined in your master resource library. For an example of the standard XML file format, see XML File Format. Here are sample INI settings in your FSISYS.INI file:
< Data >
AFGJOBFile = .\deflib\afgjob.jdt
ExtrFile = .\extract\dummy.dat
< ExtractKeyField >
SearchMask = 1,XML_FILE_NAME
< Key1Table >
XML = xml
< Key2Table >
XML = xml
< KeyIDTable >
XML = xml
< Trigger2Archive >
Key1 = Key1
Key2 = Key2
KeyID = KeyID
RunDate = RunDate
< TRN_Fields >
Key1 = 1,3,N
Key2 = 5,5,N
KeyID = 10,4,N
< TRN_File >
BinaryExt = N
MaxExtRecLen = 175
< XMLTags2GVM >
Key1 = Key1,Req
Key2 = Key2,Req
KeyID = TransactionID,Opt
Here is a sample of the DUMMY.DAT file, pointed to by the ExtrFile option in the Data control group in your FSISYS.INI file.
0 1
1 5
XML_FILE_NAME This is a dummy extract file.
Using the File Option
This example imports the F_FILE.XML file from the \export directory. Using this file, the GenData program creates the recipient batch, NA, POL, and NewTrn files needed for GenPrint and GenArc processing.
Here is an excerpt from a sample AFGJOB.JDT file using the File option:
< Base Rules >
;RULStandardJobProc;;;
…
< Base Form Set Rules >
;NoGenTrnTransactionProc;;;
;BuildFormList;;;
;ImportXMLFile;;File=.\Export\F_File.xml;
…
Using the INI Option
This example imports the F_INI.XML file from the \export directory. Using this file, the GenData program creates the recipient batch, NA, POL, and NewTrn files needed for GenPrint and GenArc processing.
In addition to the INI options defined previously, you must also include the this option:
< Import_Data >
Import_File = .\Export\F_File.xml\
Here is an excerpt from a sample AFGJOB.JDT file:
< Base Rules >
;RULStandardJobProc;;;
…
< Base Form Set Rules >
;NoGenTrnTransactionProc;;;
;ResetOvFlw;;;
;BuildFormList;;;
;ImportNAPOLFile;;INI=Import_Data,Import_File;
…
Using the SCH Option
This example imports XML files (F_SCH1.XML, F_SCH2.XML, and F_SCH3.XML) based on the content of a line in the file pointed to by the ExtrFile option in the Data control group. Using these files, the GenData program creates the recipient batch, NA, POL, and NewTrn files needed for GenPrint and GenArc processing.
This INI option differs from the one defined in the assumed MRL definition:
< Data >
ExtrFile = .\extract\F_Sch.DAT
Here is an excerpt from the F_SCH.DAT file in the \extract directory which contains an entry (path and file name) for each XML file to import:
XML_FILE_NAME .\export\F_SCH1.xml
XML_FILE_NAME .\export\F_SCH2.xml
XML_FILE_NAME .\export\F_SCH3.xml
…
Note: This option lets you import and process multiple XML files because of the way the file name and path are specified—one file per entry in the file specified in the ExtrFile option in the Data control group.
Here is an excerpt from a sample AFGJOB.JDT file:
< Base Rules >
;RULStandardJobProc;;;
…
< Base Form Set Rules >
;NoGenTrnTransactionProc;;;
;BuildFormList;;;
;ImportXMLFile;2;SCH=1,XML_FILE_Name 15,19
Using the GVM Option
This example imports data from a XML file based on file name contained in the GVM variable called Import_File. Using this file, the GenData program creates the recipient batch, NA, POL, and NewTrn files needed for GenPrint and GenArc processing.
Any valid GVM variable can be used no matter how it is created or assigned.
This example creates the GVM variable, ImportXMLFile_GVM, by including this INI option and adding its definition to the TRNDFDFL.DFD file:
< GentrnDummyFields >
ImportXMLFile_GVM = .\export\F_GVM.xml
Here is an excerpt from a sample AFGJOB.JDT file:
< Base Rules >
;RULStandardJobProc;;;
…
< Base Form Set Rules >
;NoGenTrnTransactionProc;;;
;BuildFormList;;;
;ImportXMLFile;;GVM=ImportXMLFile_GVM