XML IMPORT FILE

This statement has the following parameters:

Parameter Description
DataItem Identifier of the COBOL data item that is to receive the data being imported.
DocumentName Nonnumeric literal or identifier of an alphanumeric data item that specifies the filename of a file that contains the XML document to be imported. If an extension is not specified in the filename, the extension .xml is appended to the specified filename.
ModelDataName Nonnumeric literal or identifier of an alphanumeric data item that specifies the name of the model data structure. (Note, this is often the same 'name' that is specified in DataItem, but as a literal enclosed in quotation marks). If the name is not found in the symbol table of the current program, then the symbol tables in the calling programs are searched in order of the call stack from nearest to farthest caller. The name may include qualifiers using // as a separator. The specification A//B//C is equivalent to the COBOL specification C OF B OF A. The top-level qualifier (A in the preceding example) may be a program-name when the name is specific to a particular program in the call stack.
[StyleSheetName] Optional. Nonnumeric literal or identifier of an alphanumeric data item that specifies the filename of an XSLT stylesheet file to be used to transform the XML document before it is imported. If an extension is not specified in the filename, the extension .xsl is appended to the specified filename.

Description

The XML IMPORT FILE statement imports the content of the file indicated by the DocumentName parameter. If the optional StyleSheetName parameter is present, the specified XSLT stylesheet is first used to transform the document. The content of the resulting document is converted to COBOL format using the structure of the ModelDataName parameter and then is stored in the data item specified by the DataItem parameter.

A status value is returned in the data item XML-Status of XML-data-group , which is defined in the copy file lixmldef.cpy.

Examples

XML IMPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT"
    "MY-DATA-ITEM".
IF NOT XML-OK GO TO Z.
XML IMPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT.XML"
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET" 
IF NOT XML-OK GO TO Z.
XML SET XSL-PARAMETERS
     "MY-COUNT", 7.
IF NOT XML-OK GO TO Z.
XML IMPORT FILE
    MY-DATA-ITEM
    "MY-DOCUMENT.XML"
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET"
IF NOT XML-OK GO TO Z