#47666 [NEW]: SaveXML not well formed
| From: | info at pcxtra dot nl | Date: | Sun, 15 Mar 2009 21:23:13 +0000 |
| Subject: | #47666 [NEW]: SaveXML not well formed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-134725@lists.php.net to get a copy of this message | ||
From: info at pcxtra dot nl
Operating system: Fedora 9
PHP version: 5.2.9
PHP Bug Type: DOM XML related
Bug description: SaveXML not well formed
Description:
------------
SaveXML method generates html element with TWO xmlns attributes (which is
not well formed XML).
Reproduce code:
---------------
$html = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
</body>
</html>
HTML;
$doc = new DOMDocument();
$doc->loadHTML( $html );
$result = $doc->saveXML();
$doc2 = new DOMDocument();
$doc2->loadXML( $result );
$result2 = $doc->saveXML();
echo $result2;
Expected result:
----------------
The expected result is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
</body>
</html>
Actual result:
--------------
Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Attribute
xmlns redefined in Entity, line: 3 in
/home/siuser/www/dev/engine/100/test.php on line 21
$result shows two xmlns attributes for the html element:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
</body>
</html>
--
Edit bug report at http://bugs.php.net/?id=47666&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47666&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47666&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47666&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47666&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47666&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47666&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47666&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47666&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47666&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47666&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47666&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47666&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47666&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47666&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47666&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47666&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47666&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47666&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47666&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47666&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47666&r=mysqlcfg