RE: Comment on DOM Level 2 § 6.1.3.

In a somewhat related issue:

========
| root |  
========
    |    =====
    |____| A |
         =====  =====
           |____| B |   <-- TreeWalker.current
                =====

If the currentNode is 'B' but then 'B' is deleted then is currentNode
changed to 'A' and parentNode to 'root'?

The DOM2/6.1.1 explains that Iterators have no current node and that allows
them to behave well when the document is modified.  Section 6.2.2 states
that the main difference between the Iterator and the TreeWalker is tree-
vs. list-view of the nodes.  Another significant difference not mentioned is
that a TreeWalker has a current node.

Was it intended that the tree walker maintains a cursor just below the
prospective parent and another cursor just above the prospective children?
(The current node is whatever is between the the cursors - which may be
NULL.)  Then in the example above when 'B' is deleted parentNode returns
'A'.

So the TreeWalker moves the cursors up and down the levels of the view of
the tree, but can only 'see' immediately above and below the cursor
positions.

Applying this notion to Dieter Köhler's example below, parentNode returns
'A'.

Any comments?

Tim Bryant
[mailto:tbryant@objfactory.com]


-----Original Message-----
From: Dieter Köhler [mailto:dkoehler@ix.urz.uni-heidelberg.de]
Sent: Thursday, September 02, 1999 12:44 PM
To: www-dom@w3.org
Subject: Comment on DOM Level 2 § 6.1.3.


Consider the following very simple tree structure:

========
| root |  <-- TreeWalker.current
========
    |    =====
    |____| A |
         =====  =====
           |____| B |
                =====

To navigate this structure we use a TreeWalker whoes filter rejects
every C node.  Now we use the firstChild method of the TreeWalker twice
and arive at the B node.  After that we insert between the A and the B
node a C node. Now we have the following tree structure:

========
| root |
========
    |    =====
    |____| A |
         =====  =====
           |____| C |
                =====  =====
                  |____| B |  <-- TreeWalker.current
                       =====		

How should the TreeWalker behave when we call its parentNode method?

Similar problems may arise for the other methods of the TreeWalker.  The
problems get even worse, if the tree structure is more complicate or the
root node is altered.

=====================================================================
 Dieter Koehler, M. A. - dkoehler@ix.urz.uni-heidelberg.de
 Huehnerstein 1, D-69121 Heidelberg, +49(0)6221-474359
 "http://www.philo.de/Philosophie-Seiten": 1000+ Philosophie-Links
 "http://www.philo.de/VirtualLibrary/14.de.htm": Deutsche Philo-Links
 "http://www.philo.de/xml": Open XML - XML-Komponenten fuer Delphi
=====================================================================

Received on Thursday, 2 September 1999 14:15:15 UTC