Output of traverse_xmlize($xml, "xml");
$xml[people][#][person][0][@][age] = "29" $xml[people][#][person][0][#][name][0][#] = "Fred Smith" $xml[people][#][person][0][#][job][0][#] = "Webmaster" $xml[people][#][person][1][@][age] = "31" $xml[people][#][person][1][#][name][0][#] = "Patrick Jefferson" $xml[people][#][person][1][#][job][0][#] = "Chef"
Data used by this example
<people> <person age="29"> <name>Fred Smith</name> <job>Webmaster</job> </person> <person age="31"> <name>Patrick Jefferson</name> <job>Chef</job> </person> </people>
How you can output the data in other ways
$xml = xmlize($data); # where $data is the xml in the above section.
$people = $xml["people"]["#"]["person"];
for($i = 0; $i < sizeof($people); $i++) {
$person = $people[$i];
$age = $person["@"]["age"];
$name = $person["#"]["name"][0]["#"];
$job = $person["#"]["job"][0]["#"];
print "$name - $age - $job<br>\n";
}
This is the output of the above example
Fred Smith - 29 - Webmaster