I have been using PHP\'s simple XML function to work with an XML file.
The below code works fine for a simple XML hierarchy:
$xml = simplexml_load_file(
That's because you need to go another level down in
Check this out, example from SimpleXMLElement::children:
$xml = new SimpleXMLElement(
'
');
foreach ($xml->children() as $second_gen) {
echo ' The person begot a ' . $second_gen['role'];
foreach ($second_gen->children() as $third_gen) {
echo ' who begot a ' . $third_gen['role'] . ';';
foreach ($third_gen->children() as $fourth_gen) {
echo ' and that ' . $third_gen['role'] .
' begot a ' . $fourth_gen['role'];
}
}
}