About Schema Wrapper Libraries (C++)
The generated C++ code can be compiled with or without Unicode support. Depending on this setting, the types string_type and tstring will both be defined as std::string or std::wstring, consisting of narrow or wide characters. To use Unicode characters in your XML file that are not representable with the current 8-bit character set, Unicode support must be enabled. Pay special attention to the _T() macros. This macro ensures that string constants are stored correctly, whether you're compiling for Unicode or non-Unicode programs.
The default mapping of XML Schema types to C++ data types is:
string_type is defined as std::string or std:wstring
C++ does not have a decimal type, so double is used.
xs:integer has unlimited range, mapped to __int64 for efficiency reasons.
xs:dateTime, date, time, gYearMonth, gYear, gMonthDay, gDay, gMonth
xs:hexBinary and xs:base64Binary
Encoding and decoding of binary data is done automatically.
All XML Schema types not contained in this list are derived types, and mapped to the same C++ type as their respective base type.
For each type in the schema, a class is generated that contains a member for each attribute and element of the type. The members are named the same as the attributes or elements in the original schema (in case of possible collisions, a number is appended). For simple types, assignment and conversion operators are generated. For simple types with enumeration facets, the methods GetEnumerationValue() and SetEnumerationValue(int) can be used together with generated constants for each enumeration value. In addition, the method StaticInfo() allows accessing schema information as one of the following types:
Classes generated from complex types include the method SetXsiType(), which enables you to set the xsi:type attribute of the type. This method is useful when you want to create XML instance elements of a derived type.
In addition to the classes for the types declared in the XML Schema, a document class (identified with "CDoc" below) is generated. It contains all possible root elements as members, and various other methods. For more information about the class, see [YourSchema]::[CDoc].
Note: The actual class name depends on the name of the .xsd schema.
For each member attribute or element of a schema type, a new class is generated. For more information about such classes, see:
Note: The actual class names depend on the name of the schema attribute or element.
See also Example: Using the Schema Wrapper Libraries.
Errors are reported by exceptions. The following exception classes are defined in the namespace altova:
Internal program logic error (independent of input data).
Base class for runtime errors.
A method was called with invalid argument values.
Exception thrown when a type conversion fails.
A value in the lexical space cannot be converted to value space.
A value in the value space cannot be converted to lexical space.
A source value cannot be represented in target domain.
An operation was attempted that is not valid in the given context.
A problem occurred while loading an XML instance.
A problem occurred while saving an XML instance.
All exception classes contain a message text and a pointer to a possible inner exception.
Returns a textual description of the exception.
Returns the exception that caused this exception, if available, or NULL.
Accessing schema information
The generated library allows accessing static schema information via the following classes. All methods are declared as const. The methods that return one of the metadata classes return a NULL object if the respective property does not exist.