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
This commit is contained in:
Kalle Sommer Nielsen 2010-10-22 14:08:30 +00:00
parent cec7396039
commit 29ab385baf

View file

@ -97,6 +97,43 @@ echo $doc->saveXML();
</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;