XML IMPORT TEXT

This statement has the following parameters:

Parameter Description
DataItem Identifier of the COBOL data item that is to receive the imported data.
DocumentPointer Identifier of a COBOL pointer data item that points to an XML document stored in memory as a text string.
DocumentLength Numeric literal or identifier of a COBOL numeric data item that specifies the length of the XML document stored in memory as a text string.
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 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 generated XML document before it is stored. If an extension is not specified in the filename, the extension .xsl is appended to the specified filename.

Description

The XML IMPORT TEXT statement imports the content of the text string indicated by the DocumentPointer and DocumentLength parameters. If the optional StyleSheetName parameter is present, the specified XSLT stylesheet is used to transform the document before being converted to COBOL data format. 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 TEXT
    MY-DATA-ITEM
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "MY-DATA-ITEM"
IF NOT XML-OK GO TO Z. 
XML IMPORT TEXT
    MY-DATA-ITEM
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "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 TEXT
   MY-DATA-ITEM
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET"
IF NOT XML-OK GO TO Z.