svn: /phpdoc/en/trunk/reference/dom/domnode/ removechild.xml
| From: | Kalle Sommer Nielsen | Date: | Fri, 22 Oct 2010 14:08:30 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/dom/domnode/ removechild.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7292@lists.php.net to get a copy of this message | ||
kalle Fri, 22 Oct 2010 14:08:30 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=304621
Log:
Fixed bug #53083 (DOMNode::removeChild() resets the namespaceURI value)
Bug: http://bugs.php.net/53083 (Open) DOMNode::removeChild()
resets the namespaceURI value
Changed paths:
U phpdoc/en/trunk/reference/dom/domnode/removechild.xml
Modified: phpdoc/en/trunk/reference/dom/domnode/removechild.xml
===================================================================
--- phpdoc/en/trunk/reference/dom/domnode/removechild.xml 2010-10-22 13:59:23 UTC (rev 304620)
+++ phpdoc/en/trunk/reference/dom/domnode/removechild.xml 2010-10-22 14:08:30 UTC (rev 304621)
@@ -97,7 +97,44 @@
</screen>
</example>
</para>
+ <para>
+ <example>
+ <title>Preserving the parent node's namespace URI</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$doc = new DOMDocument;
+$doc->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;
+?>]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ After calling this method, the <literal>DOMNode::$namespaceURI</literal>
+ property on the parent node will be reset to &null;. Above example shows
+ how to work around it.
+ </para>
+ </note>
+ </refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>