This statement has the following parameters:
Parameter | Description |
---|---|
DataItem | An identifier of the COBOL data item that is to receive the imported data. This is not necessarily the same data item as the one that produced the model template file description of the data to be imported, but must be at least as large as so described. The identifier may refer to a linkage data item that has been passed to a subprogram that does the import. The identifier may be that of a table element specified with any necessary subscripting or indexing when the application has a table of import areas. |
DocumentPointer | An identifier of a COBOL pointer data item that points to an XML document stored in memory as a text string. |
DocumentLength | An identifier of a COBOL numeric data item that contains the length of the XML document pointed to by DocumentPointer. |
ModelFileName#DataName | A nonnumeric literal or an identifier of an alphanumeric data item, the value of which may be any of the following:
|
[StyleSheetName] | A nonnumeric literal or an identifier of an alphanumeric data item, the value of which is the name of a file containing an XSLT stylesheet that will be used to transform the imported XML document before it is stored in the data item. |
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 external XSLT stylesheet is used to transform the document before being converted to COBOL data format. The content of the XML document is converted to COBOL format using the file specified by the ModelFileName#DataName parameter, and then is stored in the data item specified by the DataItem parameter.
A status value is returned in the data item XML-data-group, which is defined in the copybook, lixmldef.cpy.
Without an External XSLT Stylesheet:
XML IMPORT TEXT MY-DATA-ITEM MY-DOCUMENT-POINTER MY-DOCUMENT-LENGTH "MY-MODEL-FILE". IF NOT XML-OK GO TO Z.
With an External XSLT Stylesheet:
XML IMPORT TEXT MY-DATA-ITEM MY-DOCUMENT-POINTER MY-DOCUMENT-LENGTH "MY-MODEL-FILE" "MY-STYLE-SHEET" IF NOT XML-OK GO TO Z.
With an External XSLT Stylesheet and Parameters:
XML SET XSL-PARAMETERS "MY-COUNT", 7. IF NOT XML-OK GO TO Z. XML IMPORT TEXT MY-DATA-ITEM "MY-DOCUMENT.XML" "MY-MODEL-FILE" "MY-STYLE-SHEET" IF NOT XML-OK GO TO Z.