chregu Sun Jul 25 07:02:43 2004 EDT Modified files: /php-src NEWS /php-src/ext/simplexml simplexml.c Log: added new method SimpleXMLElement->registerNamespace(string prefix, string uri) "registers a prefix <-> namespaceURI combination for use in a later xpath query. " http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1773&r2=1.1774&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1773 php-src/NEWS:1.1774 --- php-src/NEWS:1.1773 Sat Jul 24 00:01:48 2004 +++ php-src/NEWS Sun Jul 25 07:02:42 2004 @@ -13,6 +13,7 @@ . array_intersect_ukey() (Christiano Duarte) . stream_context_get_default() (Wez) . stream_socket_enable_crypto() (Wez) + . SimpleXMLElement->registerNamespace() (Christian) - PHP will now respect extension dependencies when initializing. (Wez) - Added Cursor support for MySQL 5.0.x in mysqli (Georg) - Added proxy support to ftp wrapper via http. (Sara) http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.139&r2=1.140&ty=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.139 php-src/ext/simplexml/simplexml.c:1.140 --- php-src/ext/simplexml/simplexml.c:1.139 Tue May 4 11:03:48 2004 +++ php-src/ext/simplexml/simplexml.c Sun Jul 25 07:02:43 2004 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.139 2004/05/04 15:03:48 wez Exp $ */ +/* $Id: simplexml.c,v 1.140 2004/07/25 11:02:43 chregu Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -843,6 +843,29 @@ xmlXPathFreeObject(retval); } + +SXE_METHOD(registerNamespace) +{ + php_sxe_object *sxe; + zval *id; + int prefix_len, ns_uri_len; + char *prefix, *ns_uri; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) { + return; + } + + sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); + if (!sxe->xpath) { + sxe->xpath = xmlXPathNewContext((xmlDocPtr) sxe->document->ptr); + } + + if (xmlXPathRegisterNs(sxe->xpath, prefix, ns_uri) != 0) { + RETURN_FALSE + } + RETURN_TRUE; +} + /* }}} */ /* {{{ proto asXML([string filename]) @@ -1604,6 +1627,7 @@ SXE_ME(__construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */ SXE_ME(asXML, NULL, ZEND_ACC_PUBLIC) SXE_ME(xpath, NULL, ZEND_ACC_PUBLIC) + SXE_ME(registerNamespace, NULL, ZEND_ACC_PUBLIC) SXE_ME(attributes, NULL, ZEND_ACC_PUBLIC) SXE_ME(children, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} @@ -1651,7 +1675,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.139 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.140 $"); 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