>
> 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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php