[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] cvs: php-src /ext/simplexml simplexml.c
From:       "Rob Richards" <rrichards () php ! net>
Date:       2005-08-31 17:00:25
Message-ID: cvsrrichards1125507625 () cvsserver
[Download RAW message or body]

rrichards		Wed Aug 31 13:00:25 2005 EDT

  Modified files:              
    /php-src/ext/simplexml	simplexml.c 
  Log:
  make sxe_properties_get respect namespace scope
  
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.158&r2=1.159&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.158 php-src/ext/simplexml/simplexml.c:1.159
--- php-src/ext/simplexml/simplexml.c:1.158	Tue Aug 23 05:33:44 2005
+++ php-src/ext/simplexml/simplexml.c	Wed Aug 31 13:00:22 2005
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.158 2005/08/23 09:33:44 dmitry Exp $ */
+/* $Id: simplexml.c,v 1.159 2005/08/31 17:00:22 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -642,7 +642,7 @@
 /* {{{ _get_base_node_value()
  */
 static void
-_get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value TSRMLS_DC)
+_get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval **value, char *prefix TSRMLS_DC)
 {
 	php_sxe_object *subnode;
 	xmlChar        *contents;
@@ -659,6 +659,9 @@
 		subnode = php_sxe_object_new(sxe_ref->zo.ce TSRMLS_CC);
 		subnode->document = sxe_ref->document;
 		subnode->document->refcount++;
+		if (prefix) {
+			subnode->iter.nsprefix = xmlStrdup(prefix);
+		}
 		php_libxml_increment_node_ptr((php_libxml_node_object *)subnode, node, NULL TSRMLS_CC);
 
 		(*value)->type = IS_OBJECT;
@@ -712,6 +715,10 @@
 				}
 			}
 
+			if (node->type == XML_ELEMENT_NODE && (! match_ns(sxe, node, sxe->iter.nsprefix))) {
+				goto next_iter;
+			}
+
 			name = (char *) node->name;
 			if (!name) {
 				goto next_iter;
@@ -719,7 +726,7 @@
 				namelen = xmlStrlen(node->name) + 1;
 			}
 
-			_get_base_node_value(sxe, node, &value TSRMLS_CC);
+			_get_base_node_value(sxe, node, &value, sxe->iter.nsprefix TSRMLS_CC);
 
 			h = zend_hash_func(name, namelen);
 			if (zend_hash_quick_find(rv, name, namelen, h, (void **) &data_ptr) == SUCCESS) {
@@ -1760,7 +1767,7 @@
 {
 	php_info_print_table_start();
 	php_info_print_table_header(2, "Simplexml support", "enabled");
-	php_info_print_table_row(2, "Revision", "$Revision: 1.158 $");
+	php_info_print_table_row(2, "Revision", "$Revision: 1.159 $");
 	php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
 		"enabled");

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic