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]

Reply via email to