You can also write an XML file to a MEMPTR or to an output stream or to a LONGCHAR as the following code fragments demonstrate.

The following fragment shows how to save an XML file to a MEMPTR:

DEFINE VARIABLE memfile AS MEMPTR NO-UNDO.
. . .
hDoc:SAVE("memptr",memfile). /* SAVE( ) will set the memptr size */
. . .

The following fragment shows how to save an XML file to a LONGCHAR:

DEFINE VARIABLE longstring AS LONGCHAR NO-UNDO.
. . .
hDoc:SAVE("LONGCHAR",longstring).
. . .

The following fragment shows how to save an XML file to an output stream:

DEFINE STREAM xmlstream.
. . .
OUTPUT STREAM xmlstream TO custxml.xml.
hDoc:SAVE("stream","xmlstream").
OUTPUT CLOSE.
. . .