Sunday, October 18, 2009

Convert XML to object in Codeigniter

Here is the library to convert XML to object in Codeigniter

class CI_Xml_Handle
{
var $xml='';

function CI_Xml_Handle($xml_content)
{
$this->xml=$xml_content;
}

function XMLtoObject () {
try {
$xml_object = new SimpleXMLElement($this->xml);
if ($xml_object == false) {
return false;
}
}
catch (Exception $e) {
return false;
}

return $xml_object;
}


}

No comments:

Post a Comment