xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dane Foster" <dfos...@equitytg.com>
Subject Re: NodeIterator vs TreeWalker
Date Fri, 01 Dec 2000 17:42:21 GMT
Thanx.  I can't believe it took that long for me to get an answer.
Eventually, I figured it out on my own but I was beginning to think that
this mailing list was not the place to ask questions about XML and how the
Apache tools relate to it.

Thanx again.

Dane
----- Original Message -----
From: "Arnaud Le Hors" <lehors@us.ibm.com>
To: <general@xml.apache.org>
Sent: Thursday, November 30, 2000 3:32 PM
Subject: Re: NodeIterator vs TreeWalker


> > Dane Foster wrote:
> >
> > Can someone explain to me exactly what the difference is between a
> > NodeIterator and a TreeWalker.  I have read the W3C's definition of
> > the two so that is not what I'm looking for.  I've even written test
> > code to see what the results of iterating over an XML fragment with a
> > NodeIterator compared to a TreeWalker would return.  The returned the
> > same exact results.
>
> This was posted almost a month ago but I haven't seen any real answer so
> here I go:
>
> Although you can get the same result from the two in some cases there is
> a fundamental difference between the two: NodeIterators do not point to
> any node in the document but instead *between* two nodes. The idea is
> that the iterator is a like cursor in the document tree. As nodes are
> removed or added to the document the iterator says where it is in the
> document. Just like your insertion cursor in a text editor stays in the
> text even when you add or remove text around.
> TreeWalkers on the other hand directly points to a specific node in the
> tree. If the node being pointed to is moved around the TreeWalker will
> follow. If the node being pointed to is removed from the tree, the
> TreeWalker will follow too, effectively ending up outside the document
> tree.
> But of course if you're not mutating the tree at all they end up being
> quite similar...
>
> Hope this helps.
> --
> Arnaud  Le Hors - IBM Cupertino, XML Technology Group
>
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>


Mime
View raw message