Hi,
a NodeIterator is meant to just iterate over a list of nodes. A
TreeWalker provides a view of the tree that you can navigate via calls
such as nextSibling(), previousSibling(), parentNode(). You are correct in
saying that with whatToShow set to the same value, the default result will
be the same using nextNode(), however, TreeWalker is always defined in
terms of DocumentOrder while implementations of NodeIterator (except the
default) may access the tree in any order.
Gareth
On Wed, 26 Mar 2003 [EMAIL PROTECTED] wrote:
> I need to be able to iterate through the nodes in a DOM tree, and have been
> looking at both DOMNodeIterator and DOMTreeWalker, and I'm somewhat
> confused. Both classes seem to do very nearly the same thing.
> DOMTreeWalker has additional functionality that recognizes that it has a
> tree, methods dealing with the concepts of parent, sibling, and child
> nodes. However, if I'm reading the documentation right, if I create a
> DOMNodeIterator and a DOMTreeWalker with the same parameters, and just call
> nextNode repeatedly on each, the sequence of nodes I would get would be the
> same from both. The only exception I see is that DOMNodeIterator starts
> out with no current node. The first call to nextNode returns the root.
> While DOMTreeWalker starts out with the root being the current node.
>
> Have I missed something? Given my understanding( which very well could be
> wrong! ) I can't see any reason why I would want to use a DOMNodeIterator.
>
> Marc Robertson
> Staff Consultant
> AWD Development
> DST Systems, Inc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]