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

Re: Type-safe iteration over the DOM in DOM 2 & 3?

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Thu, 22 Mar 2001 14:02:57 -0500
To: www-dom@w3.org
Message-ID: <OF36553FE9.ABBFEE67-ON85256A17.006605B0@pok.ibm.com>

>myvisitor.execute(mynode);
> To my best knowledge, this proposal does simply **not** work

Given our inabilty to rely upon methods being overloaded by argument
signature,  we couldn't define the Visitor API as having both the methods
     execute(Element e)
and
     execute(Attr t)

We could instead code accept() separately in each node type, so it calls
executeElement() and executeAttr(). But note that this locks in a specific
set of methods on the Visitor; if we added a new node type in the future
(perhaps under DocumentType, as part of the Content Model support),  older
visitors would be unable to support it... though it might be possible to do
something with subclassing Visitor to extend it and saying that the new
nodes will only call back to a suitable ExtendedVisitor.

______________________________________
Joe Kesselman  / IBM Research
Received on Thursday, 22 March 2001 14:03:02 GMT

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