Jez Higgins

Freelance software grandad
software created
extended or repaired


Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed

Tuesday 30 October 2001 Arabica

I've been working on a DOM implementation for the last couple of weeks or so. It's hard. The way the recommendation (W3C doesn't do specifications) is written is slanted towards garbage-collected, everything's a reference type languages like Java and ECMAScript. I decided to try and make it doubly hard, by writing a DOM implementation that really can interoperate with other implementations.

Interoperating different DOMs is easy in Java. You just implement the interfaces in the org.w3c.dom package and off you go. I built a DOM on top of the Astoria XML database API, slung it around with the Xerces-J DOM, and it all just worked.

In C++ it's a different story. Because you're more or less forced to implement some form of object reference counting, you can't just define a set of abstract base classes and leave people to derive from that. You have to build a set of classes which know how to reference count, then a parallel set of classes which actually do the work. This is what Xerces-C does for instance. I don't think, though, that I'd be able to build the equivalent of my Astoria DOM in C++ and get it work with Xerces-C. It might, but it would be a load of work and I probably wouldn't be able to benefit from the code that's already there.

My solution is to define a set of concrete classes which do the ref counting, a parallel set of abstract base classes, and then derive a further set of classes which actually do the work. With me so far? An alternative implementation would derive from the set of abstract base classes, but would still use the same set of concrete wrappers. everything should interoperate ok. I think.

Anyway, it's all sitting in CVS. Any comments will be, as ever, gratefully received.


Tagged code, arabica, xml, and c++


Jez Higgins

Freelance software grandad
software created
extended or repaired

Follow me on Mastodon
Applications, Libraries, Code
Talks & Presentations

Hire me
Contact

Older posts are available in the archive or through tags.

Feed