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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat Apr 20 05:01:27 2024 UTC