In one of my models in CI i need to create a SimpleXmlElement
object but I need to extend it first to use CDATA.
So I created a library:
class SimpleXMLExtended extends SimpleXMLElement
{
public function addCData($cdata_text)
{
$node = dom_import_simplexml($this);
$no = $node->ownerDocument;
$node->appendChild($no->createCDATASection($cdata_text));
}
}
Then in my model I load this library:
$template = $this->load->library('SimpleXMLExtended', 'xml_template.php');
But since SimpleXMLElement
requires a string parameter (and codeigniter can only pass an array according to documentation) it shows error:
SimpleXMLElement::__construct() expects at least 1 parameter, 0 given
.
So how am I suppose to load this library?