XML_Document.write
Group: Output
Documentation
Writes (or appends) the xml to the specified file using the supplied encoding. The behavior specified in the existing_file
parameter will be used if the file exists. Appending will probably not work as expected for XML documents, as it will append after the root element, which is not valid XML.
If a character cannot be converted to a byte, an Encoding_Error
is raised. If on_problems
is set to Report_Warning
or Ignore
, it is replaced with a substitute (either '�' (if Unicode) or '?' depending on the encoding). Otherwise, the process is aborted. If the path to the parent location cannot be found or the filename is invalid, a File_Error.Not_Found
is raised. If another error occurs, such as access denied, an File_Error.IO_Error
is raised. Otherwise, the file is created with the encoded xlm written to it. The method returns a File
object for the written file.
Arguments
path
: The path to the target file.encoding
: The encoding to use when writing the file.on_existing_file
: Specifies how to proceed if the file already exists.include_xml_declaration
: Specifies whether to include the XML declaration in the output. (e.g.<?xml version="1.0" encoding="UTF-8"?>
)on_problems
: Specifies how to handle any encountered problems.
Remarks
Dry Run
If writing to Output context is not enabled (such as in "Design" mode), then this function will write to a temporary file. This temporary file will be automatically deleted on exit of the Enso process.
This allows for building the workflow without affecting the real files.