Oracle XML Class Generator Production (C++)

July 17, 2000

Updated to match internal changes in the XML parser, otherwise no changes.

Oracle XML Class Generator Production (C++)

External DTD parsing: The Class Generator can now parse an external DTD directly without requiring a complete (dummy) document. This uses a new feature of the Oracle XML Parser version 2.0.1, the xmlparsedtd API. The provided command-line program xmlcg has a new '-d' option to use it, see below.

Oracle XML Class Generator Production (C++)


The XML Class Generator takes a Document Type Definition (DTD) and generates classes for each defined element. Those classes are then used in a C++ program to construct XML documents conforming to the DTD. Supported operating systems are Solaris 2.6, Linux 2.2, HPUX 11.0 and NT 4 (Service Pack 3 and above).


Input is an XML document containing a DTD, or an external DTD. The document body itself is ignored; only the DTD is relevant, though the document must conform to the DTD. The underlying XML parser only accepts file names for the document and associated external entities. In future releases, URIs for additional protocols will be accepted.

The following input file encodings are supported: UTF-8, UTF-16, US-ASCII, ISO-10646-UCS-2, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, EUC-JP, SHIFT_JIS, BIG5, GB2312, KOI8-R, EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-WT, EBCDIC-CP-DK, EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT, EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-HE, EBCDIC-CP-BE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU, and EBCDIC-CP-IS. In addition, any character set specified in Appendix A, Character Sets, of the Oracle National Language Support Guide may be used.

In order to be able to use these encodings, you must have the ORACLE_HOME environment variable set and pointing to the location of your Oracle installation. In addition, the environment variables ORA_NLS, ORA_NLS32, and ORA_NLS33 must be set to point to the location of the NLS data files. On Unix systems, this is usually $ORACLE_HOME/ocommon/nls/admin/data. On Windows NT, this is usually $ORACLE_HOME/nlsrtl/admin/nlsdata.

The default encoding is UTF-8. It is recommended that you set the default encoding explicitly if using only single byte character sets (such as US-ASCII or any of the ISO-8859 character sets) for performance up to twice as fast as with multibyte character sets such as UTF-8.


Output is a pair of C++ source files, .cpp and .h, named after the DTD. Constructors are provided for each class (element) that allow an object to be created in two different ways: initially empty, then adding the children or data after the initial creation, or created with the initial full set of children or initial data. A method is provided for #PCDATA (and Mixed) elements to set the data and, when appropriate, set an element's attributes.

Licensing Agreement and Feedback

Be sure to read the licensing agreement before using this product. Please post any questions, comments, or bug reports to the XML Forum on the Oracle Technology Network. At this time OTN is your only support resource.

Relevant XML Standards


The following files and directories are found in this release: The following libraries are included:

xmlcg Usage

The standalone parser may be called as an executable by invoking bin/xmlcg like where the optional flags are as follows:

Error Message Languages

An error message file is provided in the mesg/ subdirectory. Currently, the only message file is in English although message files for other languages may be supplied in future releases. You should set the environment variable ORA_XML_MESG to point to the absolute path of the mesg/ subdirectory. Alternately, if you have an $ORACLE_HOME installed, you may copy the contents of the mesg/ subdirectory to the $ORACLE_HOME/oracore/mesg directory.