In PHP, is there an existing method to get one or more child elements by node name (recursively) or would you have to write a function for that yourself?
For example, this is my XML:
<parent>
<child>
<grandchild>Jan</grandchild>
<grandchild>Kees</grandchild>
</child>
</parent>
And I'm looking for a method that returns something like: Array( [0] => 'Jan', [1] => 'Kees' )
by means of calling something like:
$grandchildren = $xml->children('grandchild');
The above does exist according to documentation but only for namespaces.
No comments:
Post a Comment