#18197 [Opn->Ana]: DOMXML module have invalid handling of namespaces

From: Date: Wed, 14 Aug 2002 09:16:09 +0000
Subject: #18197 [Opn->Ana]: DOMXML module have invalid handling of namespaces
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16745@lists.php.net to get a copy of this message
ID: 18197 Updated by: chregu@php.net Reported By: flying@dom.natm.ru -Status: Open +Status: Analyzed Bug Type: DOM XML related Operating System: Any PHP Version: 4.2.1 New Comment: it looks like domxml can't create nodes with namespaces right now. for creating nodes with namespaces, there is the DOM spec method createElementNS(namespaceURI,name), i will implement this soon. chregu Previous Comments: ------------------------------------------------------------------------ [2002-07-06 06:11:20] flying@dom.natm.ru DOM XML module handle XML namespaces in a wrong way. Take a look at a simple example: <?php $xml = xmldoc('<?xml version="1.0"?><root xmlns:m="http://www.m.com/"/>'); $root = $xml->root(); $child = $root->add_child($xml->create_element('m:child')); echo 'Namespace prefix: '.$child->prefix().'<br>'; echo 'Node name: '.$child->tagname().'<br>'; ?> It is obvious, that result should be: Namespace prefix: m Node name: child But instead we have: Namespace prefix: Node name: m:child Moreover, it is even possible to create nodes with undeclared namespaces, like: $child = $root->add_child($xml->create_element('q:child')); and it will not return any errors. But XML document itself will be invalid after it, because of undeclared namespace. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18197&edit=1

« previous php.bugs (#16745) next »