diff --git a/functions/domxml.xml b/functions/domxml.xml index 0066b38662..a6b1af2cf6 100644 --- a/functions/domxml.xml +++ b/functions/domxml.xml @@ -1,5 +1,5 @@ - + DOM XML functions DOM XML @@ -41,6 +41,14 @@ Deprecated functions + + There a quite some functions which do not fit into the DOM standard and + should not be used anymore as listed a in the following table. + The function DomNode_append_child has changed its + behaviour. In now actually adds a child and not a sibling. If this + breaks your application use the non DOM function + DomNode_append_sibling. + Deprecated functions and its replacements @@ -543,10 +551,19 @@ DomNode_append_child + + DomNode_append_sibling + Not in DOM standard. This function emulates the former + behaviour of DomNode_append_child. + DomNode_remove_child + + DomNode_replace_child + + DomNode_has_child_nodes @@ -2285,6 +2302,44 @@ echo ""; + + + DomNode->append_sibling + + Adds new sibling to a node + + + + Description + + objectDomNode->append_sibling + objectnewnode + + + This functions appends a sibling to an existing node. + The child can be created with e.g. + DomDocument_create_element, + DomDocument_create_text etc. or simply by using any + other node. + + + Before a new sibling is added 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 + duplicate large parts of a xml document. The return value is the + added sibling. If you plan to do further modifications on the added + sibling you must use the returned node. + + + This function has been added to provide the behaviour of + DomNode_append_child as it works till PHP 4.2. + + See also DomNode_append_before. + + + + DomNode->remove_child @@ -2299,9 +2354,62 @@ echo ""; objectoldchild - This functions removes a child from a list of children. If child cannot + This functions removes a child from a list of children. If the child cannot be removed or is not a child the function will return false. - If the child could be removed the functions returns the old child. + If the child could be removed the function returns the old child. + + + + Removing a child + +get_elements_by_tagname("tbody"); +$element = $elements[0]; +$children = $element->child_nodes(); +$child = $element->remove_child($children[0]); + +echo "
";
+$xmlfile = $dom->dump_mem(true);
+echo htmlentities($xmlfile);
+echo "
"; +?> +]]> +
+
+
+ + See also DomNode_append_child. + + +
+ + + + DomNode->replace_child + + Replaces child from list of children + + + + Description + + objectDomNode->replace_child + objectoldchild + objectnewchild + + + This functions replace a child from a list of children. If the child cannot + be replaced or the old child cannot be found the function will return + false. + If the child could be replaced the function returns the old child.