I have an XML file like such:
<spice>
<sections>
<contact></contact>
<products></products>
<people></people>
<homes></homes>
<harvest></harvest>
<contactCopy>
<banners><![CDATA[Lots of <u>text</u> with tons of <a href="#">links</a> and <i>other</i> markup.]]></banners>
</contactCopy>
<homesCopy>
<banners><![CDATA[Lots of <u>text</u> with tons of <a href="#">links</a> and <i>other</i> markup.]]></banners>
</homesCopy>
<productsCopy>
<banners><![CDATA[Lots of <u>text</u> with tons of <a href="#">links</a> and <i>other</i> markup.]]></banners>
</productsCopy>
<peopleCopy>
<banners><![CDATA[Lots of <u>text</u> with tons of <a href="#">links</a> and <i>other</i> markup.]]></banners>
</peopleCopy>
<harvestCopy>
<banners><![CDATA[Lots of <u>text</u> with tons of <a href="#">links</a> and <i>other</i> markup.]]></banners>
</harvestCopy>
</sections>
</spice>
What I need to be able to do is pull the CDATA content out, WITH the tags intact, have the client edit the content with a markup editor and put unentitied HTML back into the CDATA section. I have been able to pull the content out of the CDATA field with
$doc = new DomDocument();
$file = "spice.xml";
$doc->load($file);
$xPath = new DomXPath($doc);
$homesCopy = $xPath->query("//sections/homesCopy/banners");
echo $homesCopy->item(0)->nodeValue;
but I cannot for the life of me figure out how to simply edit that content and put it back without turning the HTML tags into their entities.