#46791 [Com]: DOMDocumentFragment::appendXML should honor preserveWhiteSpace property

From: Date: Tue, 04 Aug 2009 00:38:08 +0000
Subject: #46791 [Com]: DOMDocumentFragment::appendXML should honor preserveWhiteSpace property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140623@lists.php.net to get a copy of this message
 ID:          46791
 Comment by:  david at stantonstreet dot com
 Reported By: grodny at oneclick dot sk
 Status:      Open
 Bug Type:    Feature/Change Request
 PHP Version: 5.2.7
 New Comment:

Agreed; I have encountered this behavior as well in HTML template
parsing and am not getting the benefit of removing white-space from an
appended content fragment, but the imported template has all whitespace
removed.

Thank you guys,

David


Previous Comments:
------------------------------------------------------------------------

[2008-12-07 12:35:41] grodny at oneclick dot sk

Description:
------------
Description:
------------
Appending XML source to fragment and then inserting fragment to
document tree should result in consitent white space handling, based on
document's preserveWhiteSpace property value.

Is it possible to make DOMDocumentFragment::appendXML method honor
fragment's ownerDocument->preserveWhiteSpace property value?

Thank you.

Reproduce code:
---------------
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->loadXML('<?xml version="1.0" encoding="utf-8"?>
<root>
	<child/>
</root>
');
$frag = $doc->createDocumentFragment();
$frag->appendXML('
<fragment>
	<child/>
</fragment>
');
$doc->documentElement->appendChild($frag);

$doc->formatOutput = false;
echo $doc->saveXML();

Expected result:
----------------
<?xml version="1.0" encoding="utf-8"?>
<root><child/><fragment><child/></fragment></root>


Actual result:
--------------
<?xml version="1.0" encoding="utf-8"?>
<root><child/>
<fragment>
	<child/>
</fragment>
</root>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46791&edit=1



Thread (3 messages)

« previous php.bugs (#140623) next »