4. System Classes : XMLDocument Class : WriteToFile Method
 
Share this page                  
WriteToFile Method
Using the given encoding, the WriteToFile method writes an XML document and all its tree-based structure starting with the RootElement to the file with the given file name. If the file already exists it will be overwritten, unless failifexists=TRUE.
This method has the following syntax:
integer = XMLDocument.WriteToFile(
          filename = varchar(256)]
          [, encoding = integer]
          [, indent = integer]
          [, standalone = integer]
          [, failifexists = integer])
This method has the following parameters:
filename
(Required) Specifies the file name of the document to be written
encoding
Specifies the encoding format to use for the file write. Valid values are:
XE_UTF8
XE_UTF16
Default: XE_UTF8
Descriptions of system constant values and their numeric equivalents are listed in XML Encoding Settings for XMLDocument (see XML Encoding Settings for XMLDocument).
indent
Specifies whether the XML document should be indented (according to the nesting levels of XML elements)
Default: FALSE
standalone
Specifies whether the corresponding XML processing instruction attribute should be set to YES.
Default: FALSE
failifexists
Specifies whether the file should not be overwritten if a file with the same name already exists. Valid values are:
TRUE—do not overwrite file if it exists; return ER_FAIL
FALSE—overwrite file if it exists
Default: FALSE
If the method is successful, it returns ER_OK; otherwise, it returns ER_FAIL. Descriptions of system constant values and their numeric equivalents are listed in Error Codes (see Error Codes).