]> granicus.if.org Git - php/commitdiff
@ - Added domxml_node_namespace_uri() (Rui Lopes).
authorChristian Stocker <chregu@php.net>
Sun, 7 Jul 2002 17:19:29 +0000 (17:19 +0000)
committerChristian Stocker <chregu@php.net>
Sun, 7 Jul 2002 17:19:29 +0000 (17:19 +0000)
ext/domxml/php_domxml.c
ext/domxml/php_domxml.h

index c25d26ed01b8ab4e45b3b37e5fd38b0662901d33..0fed77891d5173e8503656a74c9827536f175000 100644 (file)
@@ -386,7 +386,8 @@ static zend_function_entry php_domxmlnode_class_functions[] = {
        PHP_FALIAS(new_child,                           domxml_node_new_child,                  NULL)
        PHP_FALIAS(attributes,                          domxml_node_attributes,                 NULL)
        PHP_FALIAS(has_attributes,                      domxml_node_has_attributes,             NULL)
-       PHP_FALIAS(prefix,                                      domxml_node_prefix,                             NULL)
+       PHP_FALIAS(prefix,                              domxml_node_prefix,                             NULL)
+       PHP_FALIAS(namespace_uri,                       domxml_node_namespace_uri,                              NULL)
        PHP_FALIAS(clone_node,                          domxml_clone_node,                              NULL)
 /* Non DOM functions start here */
        PHP_FALIAS(add_child,                           domxml_node_append_child,               NULL)
@@ -2184,6 +2185,32 @@ PHP_FUNCTION(domxml_node_prefix)
 }
 /* }}} */
 
+/* {{{ proto string domxml_node_namespace_uri(void)
+   Returns namespace uri of node */
+PHP_FUNCTION(domxml_node_namespace_uri)
+{
+       zval *id;
+       xmlNode *nodep;
+       xmlNsPtr ns;
+
+       DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
+
+       DOMXML_NO_ARGS();
+
+       ns = nodep->ns;
+       if (!ns) {
+               RETURN_EMPTY_STRING();
+       }
+
+       if (ns->href) {
+               RETURN_STRING((char *) (ns->href), 1);
+       } else {
+               RETURN_EMPTY_STRING();
+       }
+}
+/* }}} */
+
+
 /* {{{ proto object domxml_node_parent(void)
    Returns parent of node */
 PHP_FUNCTION(domxml_node_parent)
index 0ba434f88e04b738c7983547b06984a5dc234f9d..62f4e4722be527da44ec2a7b34108aea75b7c54e 100644 (file)
@@ -138,6 +138,7 @@ PHP_FUNCTION(domxml_node_has_attributes);
 PHP_FUNCTION(domxml_node_has_child_nodes);
 PHP_FUNCTION(domxml_node_parent);
 PHP_FUNCTION(domxml_node_prefix);
+PHP_FUNCTION(domxml_node_namespace_uri);
 PHP_FUNCTION(domxml_node);
 PHP_FUNCTION(domxml_clone_node);
 PHP_FUNCTION(domxml_node_unlink_node);