> On Mon, 12 Jan 2004, Sterling Hughes wrote:
> > Its XML's SQL/regular expressions, draw what analogies to string processing
> > that you will, but I don't see:
> > 
> > $results = simplexml_query($element, '/child::node()');
> > foreach ($results as $result) {
> >     echo $result;
> > }
> > 
> > Signifigantly more complex then:
> > 
> > $results = $element->getChildren();
> > foreach ($results as $result) {
> >     echo $result;
> > }
> 
> I do see it that way. The first one forces the user to learn a new
> (significantly complex) language to perform simple operations, even if
> it provides a more "powerful abstraction".
>

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.

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).

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.

-Sterling

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to