#34664 [Fbk->Bgs]: DOMDocument::saveXML() result cannot be loaded using loadXML()
ID: 34664
Updated by: rrichards@php.net
Reported By: bugs dot php dot net at webdevelopers dot cz
-Status: Feedback
+Status: Bogus
Bug Type: DOM XML related
Operating System: Linux version 2.6.6
PHP Version: 5.0.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
HTML is not XML (hence the different I/O methods) so you cant expect
things to always be fixed when trying to do a conversion like that.
Previous Comments:
------------------------------------------------------------------------
[2005-09-28 05:28:03] rasmus@php.net
What exactly is the bug here? You can't have -- in an HTML/XML comment
and the warning message is telling you exactly that. Remove the a-- and
it works just fine.
------------------------------------------------------------------------
[2005-09-27 22:02:17] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
------------------------------------------------------------------------
[2005-09-27 21:43:21] bugs dot php dot net at webdevelopers dot cz
Sorry for the incorrect bug's name:
"invalid feof() results due to Zend's caching of user stream wrappers"
My browser's autocompletion prefilled it and I didn't noticed it... ;-)
------------------------------------------------------------------------
[2005-09-27 21:38:32] bugs dot php dot net at webdevelopers dot cz
Description:
------------
HTML imported using DOMDocument::loadHTML() is not saved as valid XML
using DOMDocument::saveXML()
Reproduce code:
---------------
header('Content-Type: text/plain; charset=UTF-8');
$d=new DOMDocument('1.0', 'UTF-8');
if ($d->loadHTML('<html><body><script><!-- var a=1; a--;
--></script></body></html>')) {
echo "loadHTML: OK\n";
echo $d->loadXML($d->saveXML());
}
Expected result:
----------------
loadHTML: OK
1
Actual result:
--------------
loadHTML: OK
<br />
<b>Warning</b>: DOMDocument::loadXML() [<a
href='function.loadXML'>function.loadXML</a>]: Comment not terminated
<!-- var a=1; a in Entity, line: 3 in <b>test.php</b> on line
<b>9</b><br />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34664&edit=1
Thread (7 messages)