Re: Comments on DOM2 CR

keshlam@us.ibm.com writes:

> In DOMs which support the Traversal feature, the DocumentTraversal
> interface will be implemented by Document objects. This is shown in the
> examples:
>      NodeIterator
> iter=((DocumentTraversal)document).creatNodeIterator(node,
> NodeFilter.SHOW_ELEMENT, myFilter);

Really?!!  That's disgusting -- it forces the use of a cast. 

OK, so it's no worse than anything <em>else</em> in the DOM, which simply
<strong>cannot be used safely</strong> without run-time type checking.  That
doesn't make it right.

I guess I'm just too much of a language purist for this business -- I've
always been of the opinion that if you're forced to resort to a cast in
order to do something, you've found a serious design flaw in the API.

A better alternative would be a getDocumentTraversal method on Document or,
better, DOMImplementation: it would of course return null if the Traversal
feature was unimplemented.

-- 
Stephen R. Savitzky  <steve@rsv.ricoh.com>  <http://rsv.ricoh.com/~steve/>
Platform for Information Applications:      <http://RiSource.org/PIA/>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <steve@theStarport.org> URL: http://theStarport.org/people/steve/

Received on Friday, 3 March 2000 19:10:03 UTC