note 114542 added to domdocument.savexml
| From: | AlexanderFedulin | Date: | Wed, 05 Mar 2014 08:29:06 +0000 |
| Subject: | note 114542 added to domdocument.savexml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198793@lists.php.net to get a copy of this message | ||
As @fbernodi said earlier, there is a problem with saveXML of DOMNode when you have a number of
defined namespaces. The simple solution for this:
<code>
// $node is some node of some other document
$temp_document = new DOMDocument('1.0', 'utf-8');
$temp_document->appendChild($temp_document->importNode($node, true));
echo $temp_document->saveXML();
</code>
----
Server IP: 195.54.192.44
Probable Submitter: 185.9.80.14
----
Manual Page -- http://php.net/manual/en/domdocument.savexml.php
Edit -- https://master.php.net/note/edit/114542
Del: integrated -- https://master.php.net/note/delete/114542/integrated
Del: useless -- https://master.php.net/note/delete/114542/useless
Del: bad code -- https://master.php.net/note/delete/114542/bad+code
Del: spam -- https://master.php.net/note/delete/114542/spam
Del: non-english -- https://master.php.net/note/delete/114542/non-english
Del: in docs -- https://master.php.net/note/delete/114542/in+docs
Del: other reasons-- https://master.php.net/note/delete/114542
Reject -- https://master.php.net/note/reject/114542
Search -- https://master.php.net/manage/user-notes.php