W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2009

Implementing DOM3 - questions

From: Poletto Guillaume <polettog@gmail.com>
Date: Sun, 25 Jan 2009 11:33:50 +0100
To: www-dom@w3.org
Message-ID: <20090125113350.67a18a32@gruentoo.gruhome>

Hi there,

I'm thinking about making a DOM implementation in C ; for the moment it's unsure, just studying the possibility..

As I understand it, a DOM 3 implementation is not really an "implementation" but a set of interfaces specifying what a "real implementation" has to implement.
A system may provide a set of "real implementations" which would be selected
- by the system itself ( http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Bootstrap )
- by the DOM Features requested by the user ( http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-getDOMImpl )

I have a few problems/questionings from that, which are all linked together.

In the following i'll call a "DOM implementation" the system realizing the DOM interfaces, and a "DOMImplementation" a real implementation using these interfaces.

My main question is :
Do any DOMImplementation must be used the same way? In other words : does an application written with "my" DOM implementation has to be portable from a DOMImplementation to another?

Since the DOMImplementation "choice" is hidden to the user, i guess yes.

But if yes, here are some flaws with this functioning
1) If the way to use has to be the same, i think there is only one good DOMImplementation from a specific DOM implementation. I can't imagine someone making another DOMImplementation for "my" DOM implementation ; this person would rather make another DOM implementation with a different use (that would be more interesting).
2) In the world of C, the best suitable implementation for the system is usually chosen at compile time, with preprocessing statements (#if)
3) The choice is not really transparent to the user (the programmer) since he may have to choose them at least when "linking" the corresponding libraries to the program. Plus, he may have to add some code to instantiate the DOMImplementationSource objects and add them to the DOMImplementationRegistry object. However, we can imagine a DOMImplementationSource that loads at run time some dynamic libraries (for example, all the .dll/.so found in a specific directory at run time) -- maybe that was intended this way.

To sum up, a DOM implementation in C implies already a particular use, because of the way the interface system is emulated. Moreover, a DOMImplementation may not have a specific memory management scheme because the "way to use" would be different (and then the code written wouldn't be portable from a DOMImplementation to another) -- in some cases, the user would have to call free methods, and in other cases not. Thus, the memory management scheme is decided by the DOM implementation.

So i wonder what kind of differences there would be between 2 DOMImplementations from a DOM implmentation.
Maybe some examples could help.. I took a look to the javadoc, but what is said here ( http://java.sun.com/j2se/1.5.0/docs/api/org/w3c/dom/bootstrap/DOMImplementationRegistry.html#newInstance() ) doesn't help me that much

Thanks in advance
Received on Sunday, 25 January 2009 13:09:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT