Re: cvs: php-src / NEWS /ext/simplexml simplexml.c
| From: | Christian Stocker | Date: | Sun, 25 Jul 2004 14:58:22 +0000 |
| Subject: | Re: cvs: php-src / NEWS /ext/simplexml simplexml.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-27993@lists.php.net to get a copy of this message | ||
On 25.7.2004 16:53 Uhr, Sterling Hughes wrote:
pls change to registerXpathNs or registerXpathNamespace().Yep, makes sense.. chregu
-sterling Christian Stocker wrote:-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid 0x5CE1DECBchregu Sun Jul 25 07:02:43 2004 EDTModified 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=uIndex: 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");