The Document Object Model in C

DOMC is a light weight C implementation of the DOM as specified in the W3C Document Object Model Level 1 Core, Level 2 Core, and Level 2 Events recommendations. The DOM is a popular API for manipulating XML and HTML documents as a tree of nodes in memory. It is the more sophisticated but more memory constraining alternative to the SAX API.

This implementation is not W3C compliant because it lacks support for entity references, DOCTYPE nodes, DTD default values, and other peripheral functionality. The DOM_Node type and it's associated operations has been used extensively however. A simple serialization module that uses Expat is provided.

Some important requirements are:
  • The libmba library is required.
  • For i18n support the encdec package is required and the encdec package requires the __STDC_ISO_10646__ environment. Because this is not supported on many platforms UTF-8 support is disabled by default.
  • The software is targeted for the GNU Unix environment although Win32 binaries are available as is a makefile that works with MSVC++ on Windows NT4.


API Reference
Browse The Source

W3C Recommendations

Technical Reports
Level 2 Core
Level 2 Events


domc-0.8.0 released
Thu Sep 9, 2004
The DOM_Document_load/fread functions did not return 0 for success and -1 on error as advertised in the documentation. This has been changed (thus the change in minor number). A memory leak was fixed in the Expat DOCTYPE handler. Finally, the rtfx folks have supplied some more changes - large node lists now use a hashmap to improve performance.
domc-0.7.1 released
Wed Aug 4, 2004
Some minor changes from the author of rtfx have been applied. Also the package has been updated to work with the patest version of libmba.
domc-0.7.0 released
Sat Mar 22, 2003
Significant work has been performed with respect to entities, DTDs, and similar however DOMC still does not fully support this functionality. The events work has been largely completed. The API documentation has also seen significant improvements.
domc-0.6.6 released
Tue Nov 5, 2002
The portability of DOMC has been greatly improved. It is known to compile on Linux, Solaris, and Windows. This release does not add new functionality however there have been many small changes and updates particularly to the Events code. For your convenience libmba-0.4.4 has been included and incorporated into the build. The build process and documentation arrangement has also been greatly improved.
W3C Comformance Test Suite
Fri Apr 5, 2002
Before releasing domc-0.6.0 I tested it with unit test code generated from XSLT templates written by various people associated with the W3C's DOM Conformace Test Suite working group. I adapted their Java transform to generate C code for use with the Check test harness. The domc-ts-0.6.0.tar.gz package contains this transform and necessary support code to built and run these tests. This work might be a good place to start for other developers implementing the DOM in C.
domc-0.6.0 released
Sun Mar 31, 2002
DOMC will now use the locale dependant multi-byte character encoding internally for the DOM_String type. The expatls.c serialization module will read UTF-16 and UTF-8 encoded XML source files if DOMC is compiled with the encdec library. Also, the very small libmba library is now required (I became tired of copying over the various modules). The DOM Conformace Test Suite has been used to perform unit testing so I am much more confident about the stabilty of DOMC. Finally, the API Reference has been greatly improved. It was generated with the included ref.xsl XSLT style sheet.
domc-0.5.8 released
Thu Dec 20, 2001
The 0.5.7 package was not prepared properly at all. This new package has been rebuilt and tested thoroughly. It should install as described in the INSTALLATION section of the README.
domc-0.5.7 released
Wed Dec 19, 2001
Several users have asked for the ability to load and store XML documents from a file descriptor. The DOM_DocumentLS_fread and DOM_DocumentLS_fwrite methods will do just that. There have been numberous other small changes and build improvements. Sorry, no zip this time.