A Collection of DOM Implementations
by Luca Padovani and Claudio Sacerdoti Coen
SourceForge Project Page and download
Last update: May 10, 2002
SourceForge Logo


GMetaDOM is a collection of librares, each library providing a DOM implementation. Currently available bindings are for C++ (smart pointers) and Objective Caml.

The basic idea is that, given the availability of DOM implementations for the C programming language (like Gdome2), and given the uniformity of the DOM interfaces, bindings for various programming languages based on the C implementation can be built automatically, providing a small number of hand-coded classes and a set of scripts for the automatic generation of the remaining ones.

Furthermore, since a XML description of the DOM interfaces is provided as part of the documentation in the W3C DOM specification, GMetaDOM adopts XSLT as the transformation language for the automatic generation of the interfaces, and uses the xsltproc utility as the XSLT processor.

The advantages of such approach should be evident. In particular, for languages like C++ where a number of different alternative DOM implementations are feasible, each with different characteristics like easiness of use, runtime flexibility, resource requirements, the approach of automatic generation permits to create a set of coherent implementations addressing such issues separately, ultimately allowing the developer to choose the library which fits best her needs.

GMetaDOM is distributed under the GNU Lesser General Public License.


Let's think at three different kinds of developers using a C++ DOM implementation. I will call them the casual developer, the adventurer and the enthusiast.

The casual developer uses DOM in the simplest way, to access, navigate, modify documents. She will prefer a very simple interface to the DOM API, hopefully without worrying about such annoying details like memory management. An implementation based on smart pointers is all she needs.

The adventurer wants to do something more sophisticated with documents. She wants to be able to derive new classes from DOM interfaces and possibly override methods. As an example, an implementation of the MathML DOM can be done in this way. Of course, this implies that the developer must provide specific methods to instantiate his classes, and this can be done overriding the corresponding methods in the Document interface.

The enthusiast aims at the maximum flexibility. She's aware that on different system there may be different XML parsers, for this reason she wants to use a completely abstract DOM interface, which is supported by different DOM implementation that can be detected and properly loaded at runtime. This approach results in a heavier implementation due the inheritance mechanism of C++, but this is the price to pay in order to have this level of flexibility.

One of the aims of GMetaDOM is to provide implementations which can satisfy the needs of all these kinds of users, minimizing the code that has to be rewritten in each case. Of course, the automatic generation is the main help in this case, however, for example, it is reasonable to suppose that the implementation of DOM strings is exactly the same in all three cases. Having these library generated by the same package allows the sharing of common pieces of code, and the creation of more coherent interfaces.


In order to compile all the libraries provided by GMetaDOM you need the following packages installed in your system: The following software is needed if you intend to build the Ocaml bindings:

Much like the source code for the bindings is automatically generated, so is documentation. Actually, one could simply browse the DOM specification and simply convert the types into the appropriate structures used in the particular binding, however we feel that a self-contained document is easier to read, and anyway features not specified by the standard might be available in some/all bindings.

Browse the documentation for the C++ binding [.html, .tar.gz].

Author: Luca Padovani