Re: DocumentTraversal

On Tue, Apr 10, 2001 at 09:06:59AM -0400, Jeff Winter wrote:
> 
> 
> Thanks.  But are you saying that this is by convention?  I can't find
> anything in the standard
> that guarantees that such a cast will always work, i.e., the class that
> implements Document will also
> implement DocumentTraversal.
> 
> >>Is there a parser-independent way to obtain a DocumentTraversal interface?
> >>Does this imply that the class implementing the (DOM Level 2) Document is
> >>guaranteed to also support DocumentTraversal?
> >
> > Check hasFeature to find out if the document support the Traversal APIs.
> If
> > it does, you should be able to cast the Document into a DocumentTraversal.
> > (Details of casting are language-dependent, but should be the same for all
> > implementations that share a single language binding.)

If DOMImplementation.hasFeature says that 'Traversal' is implemented, the
cast is guaranteed to work. That's the nature of hasFeature.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------

Received on Tuesday, 10 April 2001 09:32:27 UTC