This is what the result should look like when i parse it through a SAX parser
http://img13.imageshack.us/img13/6950/75914446.jpg
This is the XML source code from which i need to generate the display:
<orders>
<order>
<count>37</count>
<price>49.99</price>
<book>
<isbn>0130897930</isbn>
<title>Core Web Programming Second Edition</title>
<authors>
<count>2</count>
<author>Marty Hall</author>
<author>Larry Brown</author>
</authors>
</book>
</order>
<order>
<count>1</count>
<price>9.95</price>
<yacht>
<manufacturer>Luxury Yachts, Inc.</manufacturer>
<model>M-1</model>
<standardFeatures oars="plastic" lifeVests="none">false</standardFeatures>
</yacht>
</order>
<order>
<count>3</count>
<price>22.22</price>
<book>
<isbn>B000059Z4H</isbn>
<title>Harry Potter and the Order of the Phoenix</title>
<authors>
<count>1</count>
<author>J.K. Rowling</author>
</authors>
</book>
</order>
i really have no clue how to code the functions but i have just set up the parser
$xmlParser = xml_parser_create("UTF-8");
xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xmlParser, 'startElement', 'endElement');
xml_set_character_data_handler($xmlParser, 'HandleCharacterData');
$fileName = 'orders.xml';
if (!($fp = fopen($fileName, 'r'))){
die('Cannot open the XML file: ' . $fileName);
}
while ($data = fread($fp, 4096)){
$parsedOkay = xml_parse($xmlParser, $data, feof($fp));
if (!$parsedOkay){
print ("There was an error or the parser was finished.");
break;
}
}
xml_parser_free($xmlParser);
function startElement($xmlParser, $name, $attribs)
{
}
function endElement($parser, $name)
{
}
function HandleCharacterData($parser, $data)
{
}