]> granicus.if.org Git - php/commitdiff
MFH (Fix for Bug #20639 DomElement->get_elements_by_tagname() doesn't work)
authorChristian Stocker <chregu@php.net>
Tue, 26 Nov 2002 15:39:13 +0000 (15:39 +0000)
committerChristian Stocker <chregu@php.net>
Tue, 26 Nov 2002 15:39:13 +0000 (15:39 +0000)
ext/domxml/php_domxml.c

index c00f618b6716179170c2d80418c8c2696b0af49d..c4f076af0f51a5f86e7a14dfbfa52b1d1a5d7eec 100644 (file)
@@ -616,11 +616,12 @@ static inline void node_list_wrapper_dtor(xmlNodePtr node)
        }
 }
 
-static xmlNodeSetPtr php_get_elements_by_tagname(xmlNodePtr n, xmlChar* name)
+static xmlNodeSetPtr php_get_elements_by_tagname(xmlNodePtr n, xmlChar* name, xmlNodeSet *rv )
 {
-       xmlNodeSetPtr rv = NULL;
        xmlNodePtr cld = NULL;
-
+       /* TODO
+          Namespace support
+        */
        if ( n != NULL && name != NULL ) {
                cld = n->children;
                while ( cld != NULL ) {
@@ -632,6 +633,7 @@ static xmlNodeSetPtr php_get_elements_by_tagname(xmlNodePtr n, xmlChar* name)
                                        xmlXPathNodeSetAdd( rv, cld );
                                }
                        }
+                       rv = php_get_elements_by_tagname(cld, name, rv);
                        cld = cld->next;
                }
        }
@@ -3042,7 +3044,7 @@ PHP_FUNCTION(domxml_elem_get_elements_by_tagname)
        xmlNode *nodep;
        int name_len,i;
        char *name;
-       xmlNodeSet *nodesetp;
+       xmlNodeSet *nodesetp = NULL;
 
        DOMXML_PARAM_TWO(nodep, id, le_domxmlelementp, "s", &name, &name_len);
 
@@ -3053,7 +3055,7 @@ PHP_FUNCTION(domxml_elem_get_elements_by_tagname)
                RETURN_FALSE;
        }
 
-       nodesetp = php_get_elements_by_tagname(nodep,name);
+       nodesetp = php_get_elements_by_tagname(nodep, name, NULL);
 
        if(nodesetp) {
                for (i = 0; i < nodesetp->nodeNr; i++) {