|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32033 preserveWhiteSpace and impoted nodes dosn't work
Submitted: 2005-02-20 10:59 UTC Modified: 2005-02-20 14:20 UTC
From: xhemjl at tlen dot pl Assigned:
Status: Not a bug Package: XML related
PHP Version: 5.0.2 OS: Linux
Private report: No CVE-ID: None
 [2005-02-20 10:59 UTC] xhemjl at tlen dot pl
$doc->preserveWhiteSpace = false;

works fine up to the point when I try to load external XML file.

why is it so important?

firstChild, previousSibling are DOMText so I have to use
getElementsByTagName() which is much slower...
especially when I know that the node I'm interested in
is firstChild (XSD schema)

the $pFileName points to XML file eg.

my DOM:
DOM/XML 	enabled
DOM/XML API Version 	20031129
libxml Version 	2.6.6
HTML Support 	enabled
XPath Support 	enabled
XPointer Support 	enabled
Schema Support 	enabled
RelaxNG Support 	enabled

Reproduce code:
// up to this point whitespaces are OK
// $doc->preserveWhiteSpace = false;
// load new DomDocument
$tmpXml = DomDocument::load($pFileName);
// preserve whitespaces
$tmpXml->preserveWhiteSpace = false;
$tmpNode = $tmpXml->documentElement;
$contents->appendChild($doc->importNode($tmpNode, true)));

Expected result:
<?xml version="1.0" encoding="ISO-8859-2"?>

Actual result:
<?xml version="1.0" encoding="ISO-8859-2"?>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-20 14:20 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 20:01:24 2020 UTC