note 96055 modified in class.domdocument by danbrown
| From: | danbrown@php.net | Date: | Fri, 05 Feb 2010 18:05:26 +0000 |
| Subject: | note 96055 modified in class.domdocument by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165692@lists.php.net to get a copy of this message | ||
For anyone else who has been having issues with formatOuput not working, here is a work-around:
rather than just doing something like:
<?php
$outXML = $xml->saveXML();
?>
force it to reload the XML from scratch, then it will format correctly:
<?php
$outXML = $xml->saveXML();
$xml = new DOMDocument();
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml->loadXML($outXML);
$outXML = $xml->saveXML();
?>
--was--
For anyone else who has been having issues with formatOuput not working, here is a work-around:
rather than just doing something like:
$outXML = $xml->saveXML();
force it to reload the XML from scratch, then it will format correctly:
$outXML = $xml->saveXML();
$xml = new DOMDocument();
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml->loadXML($outXML);
$outXML = $xml->saveXML();
http://php.net/manual/en/class.domdocument.php