Re: Level 3 XPath doesn't feel right

> On Mon, 16 Dec 2002 09:25:05 -0800 Ray Whitmer wrote:
> In DOM Level 3 working drafts, there already is a new method called,
> I believe, "getInterface" which accepts a feature name. It has some issues
> to be worked out, but could be applied to what you have described.
>
> But in this case, it just doesn't seem at all like the pain of adding an
object
> obtainable from every node is worth it. The alternative we have today is
clean,
> modular, easy. Many/most implementations will not ever build a framework for
> dynamically attaching things such as XPath implementations to every node
of the tree.


But my understanding of popular OO languages is that a base class virtual
function only has to implemented in one place, and the behavior is
inherited automatically.  The extension only needs to be implemented in
(Node?) base class.  Am I missing something obvious?

More below...


>>The downside to this alternative is I guess that the extension can not be 
>>separated from DOM, for use with alternative DOM. However, my cursory 
>>understanding is that DOM already has features (getDOMImplementation()) for 
>>morphing itself. 
> 
>
>Again, it is possible, but that does not mean that it is desirable to
require XPath
> implementations to jump through these hoops when passing a node as an
> argument to a more-global evaluator is so much easier, and I think is
easier for
> the user to understand, as well. If I write a convenience routine that
works with
> arbitrary XPath implementations, and the application needs it to work
with a specific
> one, I like the idea of passing an XPathEvaluator much more than passing
a feature
> name and querying each node. The application might even supply the
XPathEvaluator itself.


I just realized the two api models are NOT mutually exclusive.  The
"getInterface" can merely expose the XPathEvaluator as an OO wrapper in the
DOM node.  And per above, I think it only needs to be implemented in once
place-- the base class.

So then we get the best of both, and this api methology can be applied to
all new extensions to the DOM.

-Shelby Moore

Received on Monday, 16 December 2002 13:46:45 UTC