IMPORT XML command

Used to define ACL tables from XML data files.


IMPORT XML TO table import_filename FROM source_filename
[field_syntax] <...n>


field_syntax ::=
FIELD name type AT value DEC value WID value PIC value AS display_name
RULE xpath_expression


TO table

Specifies the name of the ACL table to import the data into.


Specifies the name of the ACL data file. The import_filename parameter must be specified as a quoted string with a .FIL file extension (e.g., "Invoices.FIL").

If you do not want to create the .FIL file in the same directory as the ACL project, you can specify an absolute or relative file path to save the .FIL file to an existing folder.

For example: "C:\data\Invoices.FIL" or "data\Invoices.FIL"

FROM source_filename

Specifies the name of the source data file. This parameter must be specified as a quoted string.

If the source data file is not located in the same directory as the ACL project, you must use an absolute path (e.g., "C:\data\source_filename") or a relative path (e.g., "data\source_filename") to specify the file location.

FIELD name type

Specifies the name and data type of the field. For information on the values you can enter for the type parameter, see Identifiers for field data types.

AT value

Specifies the start position for the field in the data file.

DEC value

Specifies the number of decimals.

WID value

Specifies the length of the field in the ACL table layout.

PIC value

Specifies the format for date and numeric fields. For numeric fields the format specifies how the values are displayed. For date fields, the format specifies how dates are stored and read from the data source.

AS display_name

Specifies the display name (alternate column title) for the field in the ACL view. The AS parameter is required when you are defining a field. If you want the display name to be the same as the field name, you can enter a blank display_name value using the following syntax: AS "". Make sure there is no space between the two double quotation marks.

RULE xpath_expression

The XPath expression used to select the field contents from the XML file. XPath is a standard way of accessing data from XML files. For example, acct/title/text() retrieves the text within the <title> tag in the XML file.


The following example imports data from an XML file to an ACL table named Employees.

IMPORT XML TO Employees "Employees.fil" FROM "emp.XML"
FIELD "Empno" C AT 1 DEC 0 WID 6 PIC "" AS "" RULE "/RECORDS/RECORD/Empno/text()" 
FIELD "First" C AT 7 DEC 0 WID 13 PIC "" AS "" RULE "/RECORDS/RECORD/First/text()" 
FIELD "Last" C AT 20 DEC 0 WID 20 PIC "" AS "" RULE "/RECORDS/RECORD/Last/text()"
FIELD "HireDate" D AT 40 DEC 0 WID 10 PIC "YYYY-MM-DD" AS "" 
  RULE "/RECORDS/RECORD/HireDate/text()" 
FIELD "Salary" N AT 50 DEC 2 WID 8 PIC "" AS "" 
  RULE "/RECORDS/RECORD/Salary/text()"

(C) 2015 ACL Services Ltd. All Rights Reserved.