Extensions.Xml.XmlSaveToFile

From emotive
Jump to navigation Jump to search

Classification

Name XmlSaveToFile
Short Description Writes the XmlDocument in a file.
Class Action
Extension OTX Xml extension
Group Xml related Actions
Exceptions FileSaveException
Checker Rules -
Standard Compliant Yes

OTL Syntax

Xml.XmlSaveToFile(XmlDocumentTerm document, StringTerm path);

Description

The XmlSaveToFile action is used to write the XmlDocument in a file.

The document is serialized using its encoding. The resulting file shall contain a prolog which specifies the character encoding and XML version.

For encodings which require a byte-order mark (BOM), such as UTF-16, a BOM shall be inserted before the prolog. For other encodings, it is unspecified whether a BOM will be inserted.

Icons Note.png NOTE — If the directory does not exist, the directory and all ancestors shall be created automatically.

Properties

Name Data Type Class Default Cardinality Description
Document XmlDocument Term - [1..1] The XmlDocument object, to which the operation is applied.
Path String Term - [1..1] The URI path to the file. The path parameter is permitted to specify relative or absolute path information.

OTL Examples

/// Local Declarations

Xml.XmlElement XmlElement1;
Xml.XmlDocument XmlDocument1;

/// Flow

XmlElement1 = Xml.CreateXmlElement("root", "text", {"attribute":"abc"});
XmlDocument1 = Xml.CreateXmlDocument(XmlElement1, "1.0", @Encoding:UTF-8, false);
Xml.XmlSaveToFile(XmlDocument1, "XmlStorage/XmlSaveToFile_TC01.xml");

See also

AddXmlChildElement
DeleteXmlAttribute
DeleteXmlChildElement
SetXmlComment
SetXmlElementAttribute
SetXmlElementAttributes
SetXmlElementText
SetXmlProcessingInstructions
ValidateXml