Hi Coopster this code wil output the xml in its entirety but in bold, which is great but not if you want to just grab some elements and not others in this xml file.
[
cheaperholidays.com...]
These are the elements we want but i cannot figure out how to get this to work for the first 5 only.
<name>Sunstar</name> <siteDescription> <partnerLink>
<?php
$file = "cheaper.xml";
function contents($parser, $data){
echo $data;
}
function startTag($parser, $data){
echo "<b>";
}
function endTag($parser, $data){
echo "</b><br />";
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$fp = fopen($file, "r");
$data = fread($fp, 80000);
if(!(xml_parse($xml_parser, $data, feof($fp)))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
fclose($fp);
?>