I'm not arguing whether or not getChildren() is easier. Of course it is. I'm arguing that getChildren() is not within the spirit of the simplexml extension, which is explicitly designed to be without accessor methods. I further, because of the availability of XPath don't see the need to have such an accessor. Perhaps I would reconsider if this were a particularly hard problem to solve without internal functions, but when its so simple, I don't see the point.
There are plenty of other utility API's the extension could have that will help in using it. getElementsByTagName() is a great function to have - its simple *and* more efficient than Xpath, why isn't it there? Because that's not what this extension is about. Its not about an "easy" API for XML, or an "efficient" API for XML. Although it is signifigantly easier and more efficient. It's a *simple*, uncluttered API for XML.
I think that no matter what, it stays simple because you don't have to use the methods. The methods make it "easy" and quite a bit more powerful.
SimpleXML is *not* supposed to reinvent DOM. It is supposed to be a data structure view of XML that can easily be integrated with other future components (such as XmlReader and XmlWriter API's).
It's not supposed to be DOM but I think there's a lot of added value in making it easy/simple to do some of the basic methods. I agree it shouldn't be bloated with all of DOM's capabilities.
I can accept getChildren() and getAttributes() (or better, just children() and attributes()) as methods on objects, but I'm not happy with them at all. These two methods were considered for inclusion in my original thoughts on simplexml, and I decided against them for the reasons I've mentioned above. Anyhow, shall we put it to a vote on these two methods and move on?
I'm -1 on having them.
+1 and I prefer get*() :)
Andi
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php