#33376 [Opn->Bgs]: incorrect namespaces parsing with html file
| From: | chregu@php.net | Date: | Fri, 17 Jun 2005 08:47:26 +0000 |
| Subject: | #33376 [Opn->Bgs]: incorrect namespaces parsing with html file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-80519@lists.php.net to get a copy of this message | ||
ID: 33376
Updated by: chregu@php.net
Reported By: frederic dot lecointre at burnweb dot net
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: w2k
PHP Version: 5.0.4
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
loadHTML is for loading HTML4 documents, which per standard
don't know anything about namespaces, therefore the default
xmlns namespace isn't set. If you want to load namespaced and
well-formed documents, use loadXML() (which works perfectly
fine on your example)
Previous Comments:
------------------------------------------------------------------------
[2005-06-17 02:39:36] frederic dot lecointre at burnweb dot net
Description:
------------
incorrect namespaces parsing with html file and DOMDocument::loadHTML
xmlns can't be a namesspace prefix!
html can have mutliple namespaces
Reproduce code:
---------------
<?php
$html_string = '
<!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"
xml:lang="fr"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:tag="http://tag.com/tag">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1" />
</head>
<body >
<xforms:view >
<tag:form id="helloForm"></tag:form>
</xforms:view>
</body>
</html>
';
$doc = new DOMDocument('1.0', 'iso-8859-1');
$doc->loadHTML($html_string);
?>
Actual result:
--------------
Warning: DOMDocument::loadHTML(): Namespace prefix xmlns of attribute
xforms is not defined in Entity, line: 3
Warning: DOMDocument::loadHTML(): Namespace prefix xmlns of attribute
tag is not defined in Entity, line: 3
Notice: DOMDocument::loadHTML(): Namespace prefix xforms is not defined
in Entity, line: 9
Warning: DOMDocument::loadHTML(): Tag xforms:view invalid in Entity,
line: 9
Notice: DOMDocument::loadHTML(): Namespace prefix tag is not defined in
Entity, line: 10
Warning: DOMDocument::loadHTML(): Tag tag:form invalid in Entity, line:
10 in
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33376&edit=1