Altova XMLSpy 2024 Enterprise Edition

When code is generated from an XML Schema, the generated code provides a document class with the same name as the schema. This class contains all possible root elements as members, as well as the following methods. Note that, in the method names below, "CDoc" stands for the name of the generated document class itself.

 

Methods

Name

Description

static CDoc CreateDocument()

Creates a new, empty XML document. Must be released using DestroyDocument().

static void DeclareAllNamespacesFromSchema(ElementType& node)

Declares all namespaces from the XML Schema on the element supplied as argument (typically, the XML root element). Calling this method is useful if your schema has multiple namespace declarations, each mapped to a prefix, and you would like to declare all of them on the element supplied as argument.

void DestroyDocument()

Destroys a document. All references to the document and its nodes are invalidated. This must be called when you finish working with a document.

static CDoc LoadFromBinary(const std:vector<unsigned char>& xml)

Loads an XML document from a byte array.

static CDoc LoadFromFile(const string_type& fileName)

Loads an XML document from a file.

static CDoc LoadFromString(const string_type& xml)

Loads an XML document from a string.

std::vector<unsigned char> SaveToBinary(bool prettyPrint)

Saves an XML document to a byte array. When set to true, the prettyPrint argument re-formats the XML document for better readability.

std::vector<unsigned char> SaveToBinary(bool prettyPrint, const string_type & encoding)

Saves an XML document to a byte array, with optional "pretty-print" formatting, with the specified encoding.

std::vector<unsigned char> SaveToBinary(bool prettyPrint, const string_type & encoding, bool bBigEndian, bool bBOM)

Saves an XML document to a byte array, with optional "pretty-print" formatting, with the specified encoding. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

void SaveToFile(const string_type & fileName, bool prettyPrint)

Saves an XML document to a file, with optional "pretty-print" formatting.

void SaveToFile(const string_type & fileName, bool omitXmlDecl)

Saves an XML document to a file. If the omitXmlDecl argument is set to true, the XML declaration will not be written.

void SaveToFile(const string_type & fileName, bool omitXmlDecl, const string_type & encoding)

Saves an XML document to a file with the specified encoding. If the omitXmlDecl argument is set to true, the XML declaration will not be written.

void SaveToFile(const string_type & fileName, bool prettyPrint, bool omitXmlDecl, const string_type & encoding, bool bBigEndian, bool bBOM)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

void SaveToFile(const string_type & fileName, bool prettyPrint, bool omitXmlDecl, const string_type & encoding, bool bBigEndian, bool bBOM, const string_type & lineend)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding and the specified line end. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

 

This method is only available if you generated the code for the Xerces3 XML library (see Code Generator Options).

void SaveToFile(const string_type& fileName, bool prettyPrint, bool omitXmlDecl, const string_type & encoding, const string_type & lineend)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding and the specified line end.

 

This method is only available if you generated the code for the Xerces3 XML library (see Code Generator Options).

void SaveToFile(const string_type & fileName, bool prettyPrint, const string_type & encoding)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding.

void SaveToFile(const string_type& fileName, bool prettyPrint, const string_type & encoding, bool bBigEndian, bool bBOM)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

void SaveToFile(const string_type& fileName, bool prettyPrint, const string_type & encoding, bool bBigEndian, bool bBOM, const string_type & lineend)

Saves an XML document to a file with the specified encoding and the specified line end. Byte order and Unicode byte-order mark can be specified for Unicode encodings.

 

This method is only available if you generated the code for the Xerces3 XML library (see Code Generator Options).

void SaveToFile(const string_type& fileName, bool prettyPrint, const string_type & encoding, const string_type & lineend)

Saves an XML document to a file, with optional "pretty-print" formatting, with the specified encoding and the specified line end.

 

This method is only available if you generated the code for the Xerces3 XML library (see Code Generator Options).

string_type SaveToString(bool prettyPrint)

Saves an XML document to a string, with optional "pretty-print" formatting.

string_type SaveToString(bool prettyPrint, bool omitXmlDecl)

Saves an XML document to a string, with optional "pretty-print" formatting. If the omitXmlDecl argument is set to true, the XML declaration will not be written.

void SetDTDLocation(const string_type & dtdLocation)

Adds a DOCTYPE declaration with the specified system ID. A root element must already exist. This method is not supported for MSXML, since it is not possible to add a DOCTYPE declaration to a document in memory.

void SetSchemaLocation(const string_type & schemaLocation)

Adds an xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute to the root element. A root element must already exist.

© 2017-2023 Altova GmbH