I'm trying to create an xml document without converting html entities but when I create and save the file with DOMDocument the < and > characters are converted to &lt; and &gt; so trying to wrap copy within <![CDATA[]]> is proving problematic.

Example of my code below:

// Initiate the XML
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;

$r = $doc->createElement("advertising");

    // <ad>
    $ad = $doc->createElement('ad');

        // <TITLE>
        $title = $doc->createElement('TITLE');

    // </ad>

// Save xml

Could anyone tell me how I prevent this?

Hi pritaeas

Thanks. I happened to find it a couple of minutes ago ;)