TheBeginner,
Convert the SImpleXML Object to an array and access it.
I can't take credit for this function, I found it a while ago on the net and neglected to take down the URL since it wasn't going into production, it was merely a proof-of-concept item.
function simplexml2array($xml) {
if (get_class($xml) == 'SimpleXMLElement') {
$attributes = $xml->attributes();
foreach($attributes as $k=>$v) {
if ($v) $a[$k] = (string) $v;
}
$x = $xml;
$xml = get_object_vars($xml);
}
if (is_array($xml)) {
if (count($xml) == 0) return (string) $x; // for CDATA
foreach($xml as $key=>$value) {
$r[$key] = simplexml2array($value);
}
if (isset($a)) $r['@'] = $a; // Attributes
return $r;
}
return (string) $xml;
}
To use:
$XMLArray = simplexml2array($simpleXmlObject);
echo $XMLArray['start-date'];