From 29ab385baf6c48d63bd74758eeb20049ba51dd54 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Fri, 22 Oct 2010 14:08:30 +0000 Subject: [PATCH] Fixed bug #53083 (DOMNode::removeChild() resets the namespaceURI value) git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@304621 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/dom/domnode/removechild.xml | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/reference/dom/domnode/removechild.xml b/reference/dom/domnode/removechild.xml index 932603bf19..18d46f5ef2 100644 --- a/reference/dom/domnode/removechild.xml +++ b/reference/dom/domnode/removechild.xml @@ -97,6 +97,43 @@ echo $doc->saveXML(); + + + Preserving the parent node's namespace URI + +load('book.xml'); + +$book = $doc->documentElement; + +// we retrieve the chapter and remove it from the book +$chapter = $book->getElementsByTagName('chapter')->item(0); + +// copy the namespace URI +$nsuri = $book->namespaceURI; + +// Delete the child node +$book->removeChild($chapter); + +// paste the namespace URI back into the parent node +$book->namespaceURI = $nsuri; +?>]]> + + + + + + &reftitle.notes; + + + After calling this method, the DOMNode::$namespaceURI + property on the parent node will be reset to &null;. Above example shows + how to work around it. + + &reftitle.seealso;