ID:               15949
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         DOM XML related
 Operating System: Linux
 PHP Version:      4.1.2
 New Comment:

This bug has been fixed in CVS.

Consider remove_child() instead of remove_node() since
remove_child() is part of DOM. Anyway, even remove_node()
returns the old node now.


Previous Comments:
------------------------------------------------------------------------

[2002-03-08 02:59:22] [EMAIL PROTECTED]

I realize that for replace_node, the W3C recommendation suggests that
you should return the node that was removed.  However, this presents a
problem when you are actually trying to write code with the xml
functions.  If you create a new node (or import it from another
document, or even clone it) and then you do a replace node somewhere,
removing the previous node and putting in your new node, there is no
way to access the node you just put in.  For all intents and purposes,
you have lost your place in the document.  I don't think the function
should change per say, but rather this following distinction.

1. Create a new node and return it to a variable $foo
2. Select a node that will be replaced $bar
3. Replace $bar with $foo using $bar->replace_node($foo)
4. Now, $foo should be a reference to the node in its new location. 
This argument is based on the recommendation sentence which states "if
the newChild is already in the tree, it is first removed".  Hence, it
would be impossible for the reference $foo to exist anywhere else then
in its new location.

Thoughts?

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=15949&edit=1

Reply via email to