I have this code to create and update xml file:
<?php
$xmlFile = 'config.xml';
$xml = new SimpleXmlElement('<site/>');
$xml->title = 'Site Title';
$xml->title->addAttribute('lang', 'en');
$xml->saveXML($xmlFile);
?>
This generates the following xml file:
<?xml version="1.0"?>
<site>
<title lang="en">Site Title</title>
</site>
The question is: is there a way to add CDATA with this method/technique to create xml code below?
<?xml version="1.0"?>
<site>
<title lang="en"><![CDATA[Site Title]]></title>
</site>