Hi,
The following example of using simpleXML to output XML data is
strong. However, would some standards savvy PHP maven guide in
outputting the list in the proper format:
<http://bushidodeep.com/exercises/xmlphp/groceries/groceries.xml>
<?php
//set the XML fike name as a php string
$myGroceryList="groceries.xml";
//load the XML file
[EMAIL PROTECTED]($myGroceryList) or die ("no file loaded");
//assign the listName element to a string
$nameOfMyShoppingList = $xml->listName;
echo "<h1>List: " . $nameOfMyShoppingList . "</h1>";
/*create a loop that will take each foodGroup element,
display its name, and then list each of the items’ names and
quantities.*/
foreach ($xml->foodGroup as $foodGroup){
echo "<h2>Food group name is " . $foodGroup->groupName . "</h2>";
foreach ($foodGroup->item as $foodItem){
echo "<br /> Item: " . $foodItem->name;
echo "<br /> Quantity: " . $foodItem->howMuch;
echo "<br />";
}
echo "<br />";
}
?>
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************