I try the search code below but it is only showing the first child node. Is something missing from my code?
----catalog.xml----
I think this is what you want
<?php
$catalog = simplexml_load_file("catalog.xml");
$category = $catalog->Category;
$found = false;
foreach($category as $c)
{
$menu = (string) ($c->Name);
if ($menu == "CAT1" )
{
foreach ($c->Location as $loc)
{
echo $loc->Room;
}
$found = true; break;
}
}
if (!$found)
{
echo "No result";
}
?>
Remove the break;
statement if you can have more than one Category with the searched Name element.
Try to revise your code to:
echo $category->Location[$i]->Room;