- simplexml_load_string: documentation ( source)
- each: documentation ( source)
<?php
$xml = "<root>
<parent>
<child name='Child1'>Moi</child>
<child name='Child2'>Terve</child>
<subparent>
<child name='Child3'>Hei</child>
</subparent>
</parent>
<child name='Child4' />
</root>";
$xml = simplexml_load_string( $xml);
$result = $xml->xpath('parent/subparent/child');
while(list( , $node) = each($result)) {
echo 'b/c: ',$node,"\n";
}