Christian Stocker wrote:

> ...
> Vivian, it's not possible the set the namespace according to the W3C
> standard, except with createElementNS(). As Adam said, in PHP 4, there
> was the option set_namespace, which isn't ported to PHP5 (yet).
> 
> Maybe we should port that function as well, to allow some deeper level
> manipulation of the namespaces...
> 
> Currently, I don't have a solution to your problem, except porting
> setNamespace to PHP5...
> 
> chregu
> 

Porting the setNamespace function to PHP5 would be nice. Another solution
could be the possibility to append a namespace-node (is the
domnamespacenode class currently used by any functions?) or the
setAttribute checks wether some "xmlns"/"xmlns:" attribute is set and
updates namespaceUri itself... would be more W3C standard compliant.

without the functionality to set the namespace it will never be possible to
overwrite the createElementNS of domdocument, as the following example
shows:

<?
        class MyElement extends DomElement {...}

        class MyDocument extends DomDocument {
                function createElement($name, ...) {
                        $element = new MyElement($name, ...);
                        return $element;
                }

                function createElementNS($uri, $name, ...) {
                        $element = new MyElement();
                        // here you should set the Namespace...
                        // ...unfortunatly impossible

                        // that would be nice
                        $element->setNamespace("http://...";);
                        // -> maybe you get into trouble with "NO MODIFICATION ALLOWED 
ERROR"!!
                        //    because node isn't appended
                        
                        // or something like
                        $element->setAttributeNS("http://www.w3c.org/2000/xmlns";, 
"xmlns",
"http://mydomain.de/";);
                        // -> maybe you get into trouble with "NO MODIFICATION ALLOWED 
ERROR"!!
                        //    because node isn't appended
                        
                        return $element;
                }
        }
?>

i think because of the problems with the MODIFICATION ERRORS while node
isn't appended, it would be best if you could define the node-namespace
with the third argument of DomElement::__construct($name, $value, $uri =
"defaultUri")...

it would be VERY nice if you think about such solutions...

thanks a lot,
vivi

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to