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

Reply via email to