XML EXPORT TEXT

This statement has the following parameters:

Parameter Description
DataItem Identifier of the COBOL data item that contains the data to be exported.
DocumentPointer Identifier of a COBOL pointer data item that will point to the generated XML document as a text string after successful completion of this statement.
DocumentLength Identifier of a COBOL numeric data item that will contain the length of the generated XML document after successful completion of this statement.
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 specified 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 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 EXPORT TEXT statement exports the content of the COBOL data item indicated by the DataItem parameter. The content of the data item is converted to an XML document using the structure of the ModelDataName parameter. The address of the resulting text string is placed in the COBOL pointer data item specified by the DocumentPointer parameter, and the length of the resulting text string is placed in the numeric data item specified by DocumentLength. If the optional StyleSheetName parameter is present, the specified XSLT stylesheet is used to transform the document after it has been generated but before it is stored as a text string.

A block of memory is allocated to hold the generated XML document. The COBOL application is responsible for releasing this memory when it is no longer needed by using XML FREE TEXT.

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 EXPORT TEXT
    MY-DATA-ITEM
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "MY-DATA-ITEM"
IF NOT XML-OK GO TO Z. 
XML EXPORT 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 EXPORT TEXT
   MY-DATA-ITEM
    MY-DOCUMENT-POINTER
    MY-DOCUMENT-LENGTH
    "MY-DATA-ITEM"
    "MY-STYLE-SHEET"
IF NOT XML-OK GO TO Z.