Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Stephen Reay
Hey all, Is there a major issue with simply adding a $limit parameter to the existing xpath() method instead, and stopping searching after that many elements are found? Cheers Stephen Sent from my iPhone > On 8 Jan 2017, at 06:19, Joe Watkins wrote: > > Evening Rowan, > > Thank you. >

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Joe Watkins
Evening Rowan, Thank you. Now we can get to the really hard problem ... naming things :D I'm afraid I have no good suggestions. I can find API's that use the suggested name, but they vary in functionality (some overlap). There's also XmlNode.SelectSingleNode from C#, but sounds pretty horrible

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Rowan Collins
On 07/01/2017 19:29, Joe Watkins wrote: Evening Roawn, There is no competition to see which single problem we are going to solve, we can fix more than one thing, obviously :) What we are discussing here is the value of this particular feature, not the value of things that nobody has taken th

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Joe Watkins
Evening Roawn, There is no competition to see which single problem we are going to solve, we can fix more than one thing, obviously :) What we are discussing here is the value of this particular feature, not the value of things that nobody has taken the time to propose, implement, or fix. This c

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Rowan Collins
On 07/01/2017 17:01, Joe Watkins wrote: Evening Rowan, I must protest: It is wasteful, unclear, and generally nasty, to create, return, and manipulate an array if you are only ever going to reference one element in code. Meh, feels like a micro-optimisation to me, and "[0] to access first s

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Kalle Sommer Nielsen
2017-01-07 18:01 GMT+01:00 Joe Watkins : > Evening Rowan, > > I must protest: It is wasteful, unclear, and generally nasty, to create, > return, and manipulate an array if you are only ever going to reference one > element in code. > > It is quite normal to know the structure of a document ahead of

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Joe Watkins
Evening Rowan, I must protest: It is wasteful, unclear, and generally nasty, to create, return, and manipulate an array if you are only ever going to reference one element in code. It is quite normal to know the structure of a document ahead of time, and this would allow you to write more succinc

Re: [PHP-DEV] SimpleXML's atXPath method

2017-01-07 Thread Rowan Collins
On 06/01/2017 14:03, Willian Veiga wrote: Hello, What do you think about a new method, called atXPath, that would return a single SimpleXMLElement? Details: https://github.com/php/php-src/pull/1717 https://bugs.php.net/bug.php?id=45201 Thank you, Willian. My first thought on this was "what

[PHP-DEV] SimpleXML's atXPath method

2017-01-06 Thread Willian Veiga
Hello, What do you think about a new method, called atXPath, that would return a single SimpleXMLElement? Details: https://github.com/php/php-src/pull/1717 https://bugs.php.net/bug.php?id=45201 Thank you, Willian.