I have this code to create and update xml file:
\');
$xml->title
Got it! I adapted the code from this great solution:
ownerDocument;
$node->appendChild($no->createCDATASection($cdata_text));
}
}
$xmlFile = 'config.xml';
// instead of $xml = new SimpleXMLElement(' ');
$xml = new SimpleXMLExtended(' ');
$xml->title = NULL; // VERY IMPORTANT! We need a node where to append
$xml->title->addCData('Site Title');
$xml->title->addAttribute('lang', 'en');
$xml->saveXML($xmlFile);
?>
XML file generated:
Thank you Petah