Routines (alphabetical) > Object Classes > File Format Object Classes > IDLffXMLDOMDocument::Save

# IDLffXMLDOMDocument::Save

The IDLffXMLDOMDocument::Save procedure method serializes the current DOM document belonging to this document object and writes it to the output source specified by the FILENAME keyword.

## Syntax

Obj->[IDLffXMLDOMDocument::]Save [, ENCODING=string] [, /EXPAND_ENTITY_REFERENCES] [, FILENAME=string | STRING=variable] [, /PRETTY_PRINT]

## Arguments

None

## Keywords

### ENCODING

Set this keyword to a scalar string specifying the encoding to be used when the XML DOM document is written to a file. If this keyword is not specified and the document was loaded with the IDLffXMLDOMDocument::Init or IDLffXMLDOMDocument::Load methods from a file, the document is written to a file using the same encoding used to load the file. If this keyword is not specified and the document was created programatically, the document is written to the file using UTF-8 encoding.

If an encoding is specified that is not supported, no error is reported and this method writes an empty file.

### EXPAND_ENTITY_REFERENCES

Set this keyword to cause the parser to replace entity references with their fully expanded substitution text as the DOM tree is written to the output file. The DOM tree itself is not changed. The default behavior is to write the entity references to the output file.

### FILENAME

Set this keyword to the name of the XML file in which to store the XML data. If FILENAME is not set or is set to “” (empty string), this method will return without storing any data on the file system.

FILENAME can contain a directory path (e.g., `'C:\Exelis\test.xml'`). IDL throws an error and stops if any of the following conditions are true:

- The directory does not exist
- The directory exists, but is not writable
- The file exists, but is not writable

Setting both the FILENAME and STRING keywords causes an error.

### PRETTY_PRINT

Set this keyword to format the output by adding white space to produce a pretty-printed, indented, reader-friendly form.

### STRING

Set this keyword to a named variable that will contain the string data representing the XML DOM document currently represented in this object. Setting the STRING keyword avoids the need for file input/output operations. As a result, setting the FILENAME and STRING keywords causes an error.

## Version History

6.1 | Introduced
6.2 | Added ENCODING keyword
6.4 | Added STRING keyword