Re: [PHP-XML-DEV] DomXPath extension
[email protected] (Christian Stocker) Sat, 24 Jul 2004 18:46:40 +0200
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <[email protected]> |
On 24.7.2004 17:43 Uhr, Adam Maccabee Trachtenberg wrote: > On Sat, 24 Jul 2004, Jason Barnett wrote: > > >>To be honest I've never written any extensions or PHP source before >>so this will be fun to try, but obviously whatever I come up with is >>not going to be optimal. But I want to see this get done so I'll >>give it my best shot... and let you all make suggestions or just >>improve it yourselves. > > > I looked at the source code last night and it doesn't look too > tough. The hardest part is also groking the libxml2 functions. > > However, all I think you really need to do is take the original > query() method and modify the part that grabs the results from libxml2 > and turns it into a string or number instead of a DOMNodeList. ... depending on the 3rd optional argument $type ;) Look also at the xsl_ext_function_php function in ext/xsl/xsltprocessor.c In there, we convert different xpath results-types to different PHP types with the help of libxml2 cast functions and ZendEngine macros If you're stuck somewhere, just ask here again (or on internals@ if it's a common php extension question) And if you have a working implementation (doesn't have to perfect or complete), just send the patch here (or a link to it) and we will have a look at it Have fun. chregu -- 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 | [email protected] | gnupg-keyid 0x5CE1DECB