Bug #27783 [Com]: DomDocument::formatOutput = true doesn' work with loaded files.
| From: | bacurastone at ymail dot com | Date: | Mon, 25 Apr 2011 07:23:57 +0000 |
| Subject: | Bug #27783 [Com]: DomDocument::formatOutput = true doesn' work with loaded files. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160357@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=27783&edit=1
ID: 27783
Comment by: bacurastone at ymail dot com
Reported by: manuel dot hesse at xplib dot de
Summary: DomDocument::formatOutput = true doesn' work with
loaded files.
Status: Bogus
Type: Bug
Package: DOM XML related
Operating System: linux fedora core 1
PHP Version: 5.0.0RC1
Block user comment: N
Private report: N
New Comment:
for rrichards@php.net thanks. it's help full
Previous Comments:
------------------------------------------------------------------------
[2004-03-31 12:16:19] rrichards@php.net
works fine for me
loading from file also creates whitespaced nodes within the document.
use $dom->preserveWhiteSpace = FALSE; before loading then
$dom->formatOutput = TRUE; before the save and the results will be the
same whether loaded from file or memory
------------------------------------------------------------------------
[2004-03-30 15:37:31] manuel dot hesse at xplib dot de
Description:
------------
The formatOutput feature doesn' t work with documents, that use
DomDocument::load() for creation. But it works with in memory DOM
Documents.
Reproduce code:
---------------
$dom = new DomDocument();
$file = "/path/to/file/dom.xml";
if (file_exists($file)) {
$dom->load($file);
} else {
$dom->appendChild(dom->createElement('foobar'));
}
printf("<pre>%s</pre>", htmlentities($dom->saveXML()));
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=27783&edit=1