I have this code to create and update xml file:
\');
$xml->title
class MySimpleXMLElement extends SimpleXMLElement{
public function addChildWithCData($name , $value) {
$new = parent::addChild($name);
$base = dom_import_simplexml($new);
$docOwner = $base->ownerDocument;
$base->appendChild($docOwner->createCDATASection($value));
}
}
$simpleXmlElemntObj = new MySimpleXMLElement(' ');
/* USAGE */
/* Standard */
$simpleXmlElemntObj->addChild('Postcode','1111');
/* With CDATA */
$simpleXmlElemntObj->addChildWithCData('State','Processing');
/* RESULT */
/*
1111
*/