note 87327 deleted from function.simplexml-element-asXML by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 15:44:08 +0000 |
| Subject: | note 87327 deleted from function.simplexml-element-asXML by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160659@lists.php.net to get a copy of this message | ||
Note Submitter: administrator at proxy-list dot org
----
Here much simpler way how to output pretty XML string instead of one, hard to understand single
line. The solution was found on the page: http://302-found.blogspot.com/2007/11/simple-simplexml.html
<?php
$doc = new DOMDocument('1.0');
$doc->preserveWhiteSpace = false;
$doc->loadXML($rss2->asXML());
$doc->formatOutput = true;
echo $doc->saveXML();
?>
The previous suggestions on that page do not work for me (since they miss
$doc->preserveWhiteSpace = false; line). I hope that code will save somebodyâs time ;)
Good luck in your project and have a nice coding
Owner of http://proxy-list.org