I'm forced to use a server running PHP 4 and the XML service that's on the server is DomXML. My question is how do I access specific elements and attributes of the following XML document using DomXML? I tried the following with no results returned. Any help is appreciated...
if (!$xml = domxml_open_file($pathToXMLdoc)) {
//the above requires absolube path
exit("Could not access the XML source.");
}
$root = $xml->document_element();
echo($root->current_conditions->conditions['data'] . "<br>");
//XML FILE BELOW
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<forecast_information>
<city data="Carlsbad, CA"/>
<postal_code data="92009"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2012-03-29"/>
<current_date_time data="2012-03-29 11:52:00 +0000"/>
<unit_system data="US"/>
</forecast_information>
<current_conditions>
<condition data="Partly Cloudy"/>
<temp_f data="62"/>
<temp_c data="17"/>
<humidity data="Humidity: 65%"/>
<icon data="/ig/images/weather/partly_cloudy.gif"/>
<wind_condition data="Wind: SW at 4 mph"/>
</current_conditions>
</weather>
</xml_api_reply>