note 94371 added to domdocument.loadxml
| From: | cuisdy at gmail dot com | Date: | Sat, 31 Oct 2009 02:45:39 +0000 |
| Subject: | note 94371 added to domdocument.loadxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162298@lists.php.net to get a copy of this message | ||
to 'szalma dot laszlo at zengo dot eu'
If you want to make sure you always got the encoding, whether it was declared or not, take the
documentElement instead of the DOMDocument, and preface it with the encoding.
$tmp_doc->loadXML( '<?xml version="1.0"
encoding="utf-8"?>'.$someXMLDoc->saveXML($someXMLDoc->documentElement) );
I was having the same problem here. Although I found a much better solution for my particular
problem, this workaround might still be useful for someone:
$tmp_doc = new DOMDocument;
$tmp_doc->loadXML( '<?xml version="1.0"
encoding="utf-8"?>'.$xSomeNode->ownerDocument->saveXML($xSomeNode) );
echo $tmp_doc->saveXML();
----
Server IP: 69.147.83.197
Probable Submitter: 190.135.210.221
----
Manual Page -- http://www.php.net/manual/en/domdocument.loadxml.php
Edit -- https://master.php.net/note/edit/94371
Del: integrated -- https://master.php.net/note/delete/94371/integrated
Del: useless -- https://master.php.net/note/delete/94371/useless
Del: bad code -- https://master.php.net/note/delete/94371/bad+code
Del: spam -- https://master.php.net/note/delete/94371/spam
Del: non-english -- https://master.php.net/note/delete/94371/non-english
Del: in docs -- https://master.php.net/note/delete/94371/in+docs
Del: other reasons-- https://master.php.net/note/delete/94371
Reject -- https://master.php.net/note/reject/94371
Search -- https://master.php.net/manage/user-notes.php