]> granicus.if.org Git - php/commitdiff
@ implemented domxml_elem_get_attribute_node(attrname) (chregu)
authorChristian Stocker <chregu@php.net>
Fri, 8 Mar 2002 22:16:07 +0000 (22:16 +0000)
committerChristian Stocker <chregu@php.net>
Fri, 8 Mar 2002 22:16:07 +0000 (22:16 +0000)
ext/domxml/php_domxml.c

index 10b240e7e37ecc53c4b1dc925d057a7d61919e1e..5fe4b4b5a9237d0d682dda6cdc1a24636a9ccece 100644 (file)
@@ -334,8 +334,8 @@ static zend_function_entry php_domxmlelement_class_functions[] = {
        PHP_FALIAS(get_attribute,                       domxml_elem_get_attribute,              NULL)
        PHP_FALIAS(set_attribute,                       domxml_elem_set_attribute,              NULL)
        PHP_FALIAS(remove_attribute,            domxml_elem_remove_attribute,   NULL)
-       PHP_FALIAS(get_attributenode,           domxml_elem_get_attribute_node, NULL)
-       PHP_FALIAS(set_attributenode,           domxml_elem_set_attribute_node, NULL)
+       PHP_FALIAS(get_attribute_node,          domxml_elem_get_attribute_node, NULL)
+       PHP_FALIAS(set_attribute_node,          domxml_elem_set_attribute_node, NULL)
        PHP_FALIAS(get_element_by_tagname,      domxml_elem_get_element_by_tagname,     NULL)
        {NULL, NULL, NULL}
 };
@@ -2219,23 +2219,19 @@ PHP_FUNCTION(domxml_elem_remove_attribute)
    Returns value of given attribute */
 PHP_FUNCTION(domxml_elem_get_attribute_node)
 {
-       zval *id, *arg1;
+       zval *id, *rv;
        xmlNode *nodep;
+       xmlAttr  *attrp;   
+       int name_len, ret;
+       char *name;
 
-       DOMXML_NOT_IMPLEMENTED();
-
-       if ((ZEND_NUM_ARGS() == 1) && getParameters(ht, 1, &arg1) == SUCCESS) {
-               id = getThis();
-               nodep = php_dom_get_object(id, le_domxmlelementp, 0 TSRMLS_CC);
-       } else {
-               WRONG_PARAM_COUNT;
+       DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
+       attrp = xmlHasProp(nodep,name);
+       if (attrp == NULL)
+       {
+               RETURN_FALSE;
        }
-
-       convert_to_string(arg1);
-
-       /* FIXME: not implemented */
-
-       RETURN_TRUE;
+       DOMXML_RET_OBJ(rv, (xmlNodePtr) attrp, &ret);
 }
 /* }}} */