note 85340 modified in function.simplexml-element-asXML by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 15:43:47 +0000 |
| Subject: | note 85340 modified in function.simplexml-element-asXML by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160657@lists.php.net to get a copy of this message | ||
DomDocument can do indentation on saveXML, so another way would be:
<?php
$simpleXml = new SimpleXmlElement('...');
// ... do your simple xml construction
$dom = dom_import_simplexml($simpleXml)->ownerDocument;
$dom->formatOutput = true;
echo $dom->saveXML();
?>
not especially better, and probably not faster, but an alternative.
--was--
DomDocument can do indentation on saveXML, so another way would be:
<?php
$simpleXml = new SimpleXmlElement('...');
// ... do your simple xml construction
$dom = dom_import_simplexml($simpleXml)->ownerDocument;
$dom->formatOutput = true;
echo $dom->saveXML();
?>
not especially better, and probably not faster, but an alternative.
http://php.net/manual/en/function.simplexml-element-asXML.php