helly Fri Feb 24 15:49:13 2006 UTC Modified files: /php-src/ext/simplexml simplexml.c Log: - Add ability to add new nodes via properties http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.187&r2=1.188&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.187 php-src/ext/simplexml/simplexml.c:1.188 --- php-src/ext/simplexml/simplexml.c:1.187 Tue Feb 21 20:12:42 2006 +++ php-src/ext/simplexml/simplexml.c Fri Feb 24 15:49:13 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.187 2006/02/21 20:12:42 dmitry Exp $ */ +/* $Id: simplexml.c,v 1.188 2006/02/24 15:49:13 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -390,6 +390,7 @@ char *name; xmlNodePtr node; xmlNodePtr newnode = NULL; + xmlNodePtr mynode; xmlNodePtr tempnode; xmlAttrPtr attr = NULL; int counter = 0; @@ -450,6 +451,8 @@ test = 0; } + mynode = node; + if (node) { if (attribs) { if (Z_TYPE_P(member) == IS_LONG) { @@ -510,6 +513,8 @@ change_node_zval(newnode, value TSRMLS_CC); } else if (counter > 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot assign to an array of nodes (duplicate subnodes or attr detected)"); + } else if (elements && !node) { + xmlNewChild(mynode, mynode->ns, name, Z_STRVAL_P(value)); } else { if (attribs) { switch (Z_TYPE_P(value)) { @@ -2032,7 +2037,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.187 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.188 $"); 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