#19333 [Csd]: incorrect handling of xml namespace
| From: | chregu@php.net | Date: | Wed, 11 Sep 2002 04:59:15 +0000 |
| Subject: | #19333 [Csd]: incorrect handling of xml namespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-19008@lists.php.net to get a copy of this message | ||
ID: 19333
Updated by: chregu@php.net
Reported By: pavlomr@hotmail.com
Status: Closed
Bug Type: DOM XML related
Operating System: SuSE Linux 7.3
PHP Version: 4CVS-2002-09-10
New Comment:
Nevertheless it's ok, what domxml (resp. libxml2) does.
If you take another namespase than
xmlns:xml='http://www.w3.org/XML/1998/namespace',
you'll see that it
will be perfectly preserved.
The "xml" namespace does not have to be declared, as it's always
associated to 'http://www.w3.org/XML/1998/namespace' per
default.
Previous Comments:
------------------------------------------------------------------------
[2002-09-10 12:28:06] pavlomr@hotmail.com
It is strange , that in previous snapshot (4CVS-2002-09-06) output was
correct (but segfaults).
And $d2->dump_mem() produce correct output.
------------------------------------------------------------------------
[2002-09-10 11:29:14] chregu@php.net
Hi
The Namespace xml is defined per default and does not have to be
declared explicitely.
If the parser does not understand this, then it's its fault and it does
not correpsond to the w3c-specs.
chregu
------------------------------------------------------------------------
[2002-09-10 09:05:38] pavlomr@hotmail.com
environment as in #19266
example:
<?php
$x1="<?xml version='1.0' encoding='iso8859-1' ?>
<root1 xml:lang='de' xmlns:xml='http://www.w3.org/XML/1998/namespace'>
<node xml:lang='en'>1 En node</node>
<node xml:lang='de'>1 De node</node>
<node>1 Default node</node>
</root1>
";
$x2="<?xml version='1.0' encoding='iso8859-1' ?>
<root2 xml:lang='en'
xmlns:xml='http://www.w3.org/XML/1998/namespace'>
<node xml:lang='en'>2 En node</node>
<node xml:lang='de'>2 De node</node>
<node> 2 Default node</node>
</root2>
";
$d1=domxml_open_mem($x1);
$d2=domxml_open_mem($x2);
$r1=$d1->document_element();
$r2=$d2->document_element();
$r1->append_child($r2->clone_node(1));
echo $d1->dump_mem();
?>
produce:
<?xml version="1.0" encoding="iso8859-1"?>
<root1 xml:lang="de">
<node xml:lang="en">1 En node</node>
<node xml:lang="de">1 De node</node>
<node>1 Default node</node>
<root2 lang="en">
<node lang="en">2 En node</node>
<node lang="de">2 De node</node>
<node> 2 Default node</node>
</root2></root1>
------------------------------------
xml prefix of xml:lang is lost !
it's independent from xmlns declaration.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19333&edit=1