note 73933 added to function.dom-domdocument-loadxml
| From: | shaoyu73 at gmail dot com | Date: | Fri, 16 Mar 2007 04:53:58 +0000 |
| Subject: | note 73933 added to function.dom-domdocument-loadxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124500@lists.php.net to get a copy of this message | ||
earth at anonymous dot com,
preserveWhiteSpace property needs to be set to false for formatOutput to work properly, for some
reason.
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->loadXML($xmlStr);
...
$element->appendChild(...);
...
$dom->formatOutput = true;
$xmlStr = $dom->saveXML();
echo $xmlStr;
This would format the output nicely.
----
Server IP: 69.147.83.197
Probable Submitter: 208.120.56.178
----
Manual Page -- http://www.php.net/manual/en/function.dom-domdocument-loadxml.php
Edit -- https://master.php.net/note/edit/73933
Del: integrated -- https://master.php.net/note/delete/73933/integrated
Del: useless -- https://master.php.net/note/delete/73933/useless
Del: bad code -- https://master.php.net/note/delete/73933/bad+code
Del: spam -- https://master.php.net/note/delete/73933/spam
Del: non-english -- https://master.php.net/note/delete/73933/non-english
Del: in docs -- https://master.php.net/note/delete/73933/in+docs
Del: other reasons-- https://master.php.net/note/delete/73933
Reject -- https://master.php.net/note/reject/73933
Search -- https://master.php.net/manage/user-notes.php