From 3afcc1f8e36f091279fb227b9340fde834e19738 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Fri, 16 Aug 2002 09:10:15 +0000 Subject: [PATCH] updated to the last source commits git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@92254 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../domxml/functions/DomNode-append-child.xml | 14 +++++++++++--- .../domxml/functions/DomNode-insert-before.xml | 12 +++++++++--- .../domxml/functions/DomNode-next-sibling.xml | 7 ++++--- .../domxml/functions/DomNode-previous-sibling.xml | 7 +++++-- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/reference/domxml/functions/DomNode-append-child.xml b/reference/domxml/functions/DomNode-append-child.xml index de1b835bc0..a8e1b53ae8 100644 --- a/reference/domxml/functions/DomNode-append-child.xml +++ b/reference/domxml/functions/DomNode-append-child.xml @@ -1,5 +1,5 @@ - + @@ -22,7 +22,7 @@ other node. - Before a new child is appended it is first duplicated. Therefore the new + (PHP < 4.3) Before a new child is appended it is first duplicated. Therefore the new child is a completely new copy which can be modified without changing the node which was passed to this function. If the node passed has children itself, they will be duplicated as well, which makes it quite easy to @@ -30,6 +30,13 @@ appended child. If you plan to do further modifications on the appended child you must use the returned node. + + (PHP >= 4.3) The new child newnode is first + unlinked from its existing context, if it already existed in a document. + Therefore the node is moved and not copies anymore. This is the behaviour + according to the W3C specifications. If you want to duplicate large parts + of a xml document, use DomNode->clone_node() before appending. + The following example will add a new element node to a fresh document and sets the attribute "align" to "left". @@ -98,7 +105,8 @@ echo ""; DomNode_append_child. - See also DomNode_insert_before. + See also DomNode_insert_before, + DomNode_clone_node. diff --git a/reference/domxml/functions/DomNode-insert-before.xml b/reference/domxml/functions/DomNode-insert-before.xml index 9470f78d58..ada975a635 100644 --- a/reference/domxml/functions/DomNode-insert-before.xml +++ b/reference/domxml/functions/DomNode-insert-before.xml @@ -1,5 +1,5 @@ - + @@ -17,10 +17,16 @@ This function inserts the new node newnode right - before the node refnode. The return value is the - inserted node. If you plan to do further modifications on the appended + before the node refnode. The return value is the + inserted node. If you plan to do further modifications on the appended child you must use the returned node. + + (PHP >= 4.3 only) If newnode already is part of a + document, it will be first unlinked from its existing context. If + refnode is NULL, then newnode + will be inserted at the end of the list of children. + DomNode_insert_before is very similar to DomNode_append_child as the following example shows diff --git a/reference/domxml/functions/DomNode-next-sibling.xml b/reference/domxml/functions/DomNode-next-sibling.xml index bf1b8c9b7a..758efda0f6 100644 --- a/reference/domxml/functions/DomNode-next-sibling.xml +++ b/reference/domxml/functions/DomNode-next-sibling.xml @@ -1,5 +1,5 @@ - + @@ -16,8 +16,9 @@ This function returns the next sibling of the current node. If there is - no next sibling it returns false. You can use this function to iterate - over all children of a node as shown in the example. + no next sibling it returns false (< 4.3) or null (>= 4.3). You can + use this function to iterate over all children of a node as shown in the + example. diff --git a/reference/domxml/functions/DomNode-previous-sibling.xml b/reference/domxml/functions/DomNode-previous-sibling.xml index 542a6e1499..8b0a02a65f 100644 --- a/reference/domxml/functions/DomNode-previous-sibling.xml +++ b/reference/domxml/functions/DomNode-previous-sibling.xml @@ -1,5 +1,5 @@ - + @@ -15,7 +15,10 @@ - This function returns the previous sibling of the current node. + This function returns the previous sibling of the current node. If there + is no previous sibling it returns false (< 4.3) or null (>= 4.3). You + can use this function to iterate over all children of a node as shown in + the example. See also DomNode_next_sibling.