Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:6999 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69966 invoked by uid 1010); 12 Jan 2004 19:30:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69894 invoked from network); 12 Jan 2004 19:30:36 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 12 Jan 2004 19:30:36 -0000 Received: from [192.168.1.100] (p508EBCF4.dip.t-dialin.net [80.142.188.244]) by shiva.mind.de (Postfix) with ESMTP id 67C6397C65; Mon, 12 Jan 2004 20:30:29 +0100 (CET) Date: Mon, 12 Jan 2004 20:29:02 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1121849153609.20040112202902@marcus-boerger.de> To: "Alexander" Cc: internals@lists.php.net In-Reply-To: <20040112152620.20216.qmail@pb1.pair.com> References: <20040112152620.20216.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] How to add new functions to SimpleXML extention From: helly@php.net (Marcus Boerger) Hello Alexander, generally a good idea but we are in feature freeze mode for PHP 5.0.x which is our current head. That means you have to suspend your idea until HEAD and PHP_5_0 are different branches. This will most likely happen during the next two months. To not forget your idea you can open a bug report and insert your idea with category 'Feature/Change request'. regards marcus Monday, January 12, 2004, 4:28:05 PM, you wrote: > Hi! > I'm just playing with simplexml and wonder if two new functions of the > simplexml_element object would be usefull: getName() and getParent(). I'm > interesting in adding them to the extention, if possible. What should I do > for this? (I also think that it may be in FAQ, but I did not find that info > with my search skills). > Basically, this is my first experiment with PHP Extensions. I may be wrong > with my code, but tests pass is ok > ----------------------- > Thank you for time, > Alexander Netkachev > http://devlink.narod.ru/ > Code for getName function: > /* {{{ getName() > */ > SXE_METHOD(getName) > { > char *name; > xmlNodePtr node; // current node > php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); > GET_NODE(sxe, node); > if (node && (name = (char *)(node->name))) { > RETURN_STRING(name, 1); > } > RETURN_EMPTY_STRING(); > } > /* }}} */ > /* {{{ getParent() > */ > SXE_METHOD(getParent) > { > xmlNodePtr node; // current node > xmlNodePtr pNode; // node->parent > php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); > GET_NODE(sxe, node); > if (node && (pNode = node->parent)) { > _node_as_zval(sxe, pNode, return_value TSRMLS_CC); > return; > } > RETURN_NULL(); > } > /* }}} */ > File: ext/simplexml/tests/019.phpt > --TEST-- > SimpleXML: Test getParent() and getName() functions > --SKIPIF-- > > --FILE-- > $doc = simplexml_load_string(''); > var_dump(trim($doc->body->getParent()->getName())); > echo '--done--'; ?>> > --EXPECT-- > string(4) "html" > --done-- -- Best regards, Marcus mailto:helly@php.net