php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27783 DomDocument::formatOutput = true doesn' work with loaded files.
Submitted: 2004-03-30 15:37 UTC Modified: 2004-03-31 12:16 UTC
From: manuel dot hesse at xplib dot de Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.0RC1 OS: linux fedora core 1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: manuel dot hesse at xplib dot de
New email:
PHP Version: OS:

 

 [2004-03-30 15:37 UTC] 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()));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-31 12:16 UTC] 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
 [2011-04-25 09:23 UTC] bacurastone at ymail dot com
for rrichards@php.net thanks. it's help full
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 16:01:30 2024 UTC