XML with C++ - To DOM or not to DOM 2005-03-14


After my rant earlier today, I've decided to toy around with writing my own C++ DOM parser, mostly as an educational experience, but perhaps it'll turn out to be useful.

My initial thought is to leverage boost::shared_ptr to get an interface that is as close to the Java DOM mappings as possible while getting a proper modern C++ look and feel to it.

One thing is bothering me, though: More and more W3 initiatives have defined their own DOM mappings, such as SVG. In order to write a truly high quality C++ DOM implementation, it needs to be reasonably feasible to layer implementations of these specs "on top" of the core DOM.

One solution might be to make the factory methods configurable and write most of the classes as templates that can be combined to create a uniform class hierarchy, but I'm unsure if it's worth the effort, and how practical it will be...

I think I'll be spending more time reading up on design patterns and principles to get good ideas on how to solve this properly than on actually writing the DOM behaviour, as that is actually very simple.


blog comments powered by Disqus