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

>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 UTC