Hi guys,
did anyone try the Simple XML for php5 tutorial?
I have no luck getting it to work.
here’s my error:
Parse error: parse error, unexpected ‘>’ in C: est\parser.php on line **11
**
<?php
//Since we're already using PHP5, why don't we exploit their easy to use file_get_contents() command?
$xmlFileData = file_get_contents("news.xml");
//Here's our Simple XML parser!
$xmlData = new SimpleXMLElement($xmlFileData);
//And here's the output.
//Outputing all of our XML to people
foreach($xmlData->story as $story) {
print(“<h2>” . $story->headline . “</h2><br />”);
print($story->description . “<br />_________________________<br />”);
print($story->headline["date"] . “<br /><br />”);
}
?>
<?xml version="1.0"?>
<news>
<story>
<headline date=”January 19, 2005”> Godzilla Attacks LA! </headline>
<description>Equipped with a Japanese Mind-control device, the giant monster has attacked important harbours along the California coast. President to take action. </description>
</story>
<story>
<headline date=”February 14, 2006”> Bigfoot Spotted at M.I.T. Dining Area </headline>
<description>The beast was seen ordering a Snapple in the dining area on Tuesday. In a related story, Kirupa Chinnathambi, an MIT engineering student has been reported missing. </description>
</story>
<story>
<headline date=”May 27, 2006”> London Angel Saves England </headline>
<description>The "London Angel" known only as "Kit" has saved the U.K. yet again. Reports have stated that she destroyed every single Churchill bobble-head dog in the country. A great heartfilled thank you goes out to her. </description>
</story>
<story>
<headline date=”June 3, 2006”> Six-eyed Man to be Wed to an Eight-armed Woman </headline>
<description>Uhhhmmm... No comment really... just a little creepy to see them together... </description>
</story>
<story>
<headline date=”July 28, 2006”> Ahmed's Birthday Extravaganza! </headline>
<description>The gifted youngster's birthday party should be a blast. He is turning thirteen and has requested a large cake, ice cream, and a petting zoo complete with pony rides. </description>
</story>
</news>