#31873 [Opn]: DOMDocument->preserveWhiteSpace not working correctly
| From: | chregu@php.net | Date: | Wed, 09 Feb 2005 08:28:21 +0000 |
| Subject: | #31873 [Opn]: DOMDocument->preserveWhiteSpace not working correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-73694@lists.php.net to get a copy of this message | ||
ID: 31873
Updated by: chregu@php.net
Reported By: becicka at aarongroup dot cz
Status: Open
Bug Type: *XML functions
PHP Version: 5.0.3
New Comment:
Just tested with the test-script saved in "Win" Format on OS X with
libxml2-2.6.16. Then this bug is reproducable. If it's saved with unix
line endings, it does the job as expected.
Previous Comments:
------------------------------------------------------------------------
[2005-02-08 12:24:45] becicka at aarongroup dot cz
There are the same situation under windows xp. It doesn't work
properly.
------------------------------------------------------------------------
[2005-02-08 12:00:45] rrichards@php.net
Do you happen to be running windows? - this looks like a libxml bug
using windows cr/lf endings to me but would like to be sure before
bogusing this and pushing it off to the libxml list.
------------------------------------------------------------------------
[2005-02-08 08:53:35] becicka at aarongroup dot cz
DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.16
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled
------------------------------------------------------------------------
[2005-02-07 19:18:19] amt@php.net
Works fine on my machine, as it returns:
<?xml version="1.0"?>
<a><B><C/></B></a>
What version of libxml2 are you using? 2.6.x? Something earlier?
------------------------------------------------------------------------
[2005-02-07 18:44:38] becicka at aarongroup dot cz
Description:
------------
$dom->saveXML() return:
<?xml version="1.0"?>
<a><B><C/>
</B></a>
instead of:
<?xml version="1.0"?><a><B><C/></B></a>
Reproduce code:
---------------
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$def = '
<a>
<B>
<C/>
</B>
</a>';
$dom->loadXML($def);
echo "<pre>";
echo htmlentities($dom->saveXML());
echo "</pre>";
Expected result:
----------------
$dom->saveXML() should return
<?xml version="1.0"?><a><B><C/></B></a>
Actual result:
--------------
<?xml version="1.0"?>
<a><B><C/>
</B></a>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31873&edit=1