Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : SAVE( ) method
 

SAVE( ) method

Saves or sends an XML document as text generated from an X-document object.
Return type: LOGICAL
Applies to: X-document object handle

Syntax

SAVE ( mode , { file | stream | stream-handle | memptr | longchar } )
mode
A character expression that evaluates to one of the following: "FILE", "STREAM", "STREAM-HANDLE", "MEMPTR", or "LONGCHAR". The mode indicates whether the XML target is a file, a stream, a MEMPTR, or a LONGCHAR variable.
file
A character expression that represents the absolute or relative pathname of a new file created to save the XML text. If you specify a relative pathname, it is relative to the current working directory of the underlying operating system's file system. If a file with the specified name already exists, the AVM verifies that the file is writeable and overwrites the file. The pathname can contain Unicode characters. See OpenEdge Development: Internationalizing Applications for more information about Unicode.
stream
A character expression that represents the name of an ABL stream. If stream is "", the AVM saves the document to the ABL session unnamed stream.
stream-handle
A character expression that represents a stream object handle.
memptr
A MEMPTR variable to contain the saved XML text in memory. The SAVE method allocates the required amount of memory and sets the size of the variable. You must release the memory later with a SET-SIZE( ) = 0.
longchar
A LONGCHAR variable to contain the saved XML text in memory.
If the LONGCHAR variable's code page is fixed (that is, set using the FIX-CODEPAGE statement) and the fixed code page is not compatible with the encoding specified in the XML document's ENCODING attribute, the SAVE( ) method returns an error and the XML document is not saved to the LONGCHAR.
If the LONGCHAR variable's code page is not fixed, the AVM converts from the XML document's code page to the -cpinternal code page and saves it to the LONGCHAR variable.
The following code fragments demonstrate the use of the SAVE( ) method:
/* Saves the current tree under hDoc as memo.xml. */
DEFINE STREAM mystream.
OUTPUT STREAM mystream to memo.xml.
hdoc:SAVE("stream","mystream").

OR

/* Saves the current tree under hDoc as memo.xml. */
hdoc:SAVE("file","memo.xml").

OR

/* Saves the current tree under hDoc in memory referred to by mymem. */
DEFINE VARIABLE hDoc  AS HANDLE NO-UNDO.
DEFINE VARIABLE mymem AS MEMPTR NO-UNDO.
. . .
hDoc:SAVE("memptr", mymem).

See also

ENCODING attribute