tsc_XmlWriter

This class is used to convert an XML tree to a well-formed XML document and write it to a file.

Available in SC version 1.90 and higher.

The following XML features are not supported by tsc_XmlWriter:

Entity escapes are written where necessary - the standard five (< > ' " &) as well as &#xhexdigits; and &#decimaldigits; where hexdigits and decimaldigits are a sequence of digits being a Unicode codepoint, a 24-bit unencoded number.  For instance the "♥" character is unicode point 0x2665 and will be written into the XML document as ♥.  

Public methods

tsc_XmlWriter ();
Constructs an XML writer.  One instance is capable of writing any number of documents.

tsc_XmlWriter (const tsc_XmlWriter&);
The copy constructor makes a reference to the same object.

void Version (const char* version);
A version string to be written in the XML declaration. Default is "1.0".  Note: If this is explicitly set to an empty string, no XML declaration line will be written

void Encoding (const char* encoding);
An encoding string to be written in the XML declaration. Default is "UTF-8". The file is always written with UTF-8 encoding without any BOM mark.

x_Code ToFile (const char* filePath, tsc_XmlElement rootNode, bool overwrite = false);
Writes an XML declaration followed by the document into a file.  If overwrite is true then any existing file will be overwritten. 

One of the following codes is returned:

X_NULL : The operation was successful.
X_Empty : The XML tree is empty (that is, there is no root node, which is necessary for an XML document to be valid).
X_FailedToCreateFile : File creation failed.
X_FileExists : The file already exists and the overwrite parameter was false.

tsc_XmlWriter& operator= (const tsc_XmlWriter& from);
Assignment makes a reference to the same tsc_XmlWriter object.