Re: SimpleXML and Default Cast To String

From: Date: Mon, 12 Jan 2004 23:05:45 +0000
Subject: Re: SimpleXML and Default Cast To String
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-7025@lists.php.net to get a copy of this message
> > On Jan 12, 2004, at 5:35 PM, Sterling Hughes wrote: > > >>>Well, this can be added with userspace handlers as I mentioned to > >>>Marcus. The real trick to XML manipulation is Xpath, not adding a > >>>bunch > >>>of broken methods. If people want to do that, they can load a > >>>simplexml > >>>object into DOM, and use the two together. ;) > >> > >>XPath cant be the answer to everything. Although it would work, XPath > >>is > > > >sure. but it can solve most of the simple problems quite efficiently, > >like getting immediate children. > > Seems to take a good bit of the Simple out of SimpleXML, IMHO. > So is generically processing child elements. Besides, if there is one technology worth learning when it comes to processing XML its Xpath. 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; } And it comes with the advantage of being a *signifigantly* more powerful abstraction. -Sterling

« previous php.internals (#7025) next »