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.

. I have been able to pull the content out of the CDATA field with

How do you know which banner you are editing at any given time? I was expecting to see each banner node with a unique id attribute so that when you edit, you would know which node to update. Where's your attempted update code?

assuming you are POSTing from a form with <input name='homesCopy'> try:

<?php
$doc = new DomDocument();
$file = "spice.xml";
$doc->load($file);
$xPath = new DomXPath($doc);
$homesCopy 	= $xPath->query("//sections/homesCopy/banners")->item(0);
if( isset($_POST['homesCopy']) ){
  $homesCopy->firstChild->nodeValue=$_POST['homesCopy'];
  $doc->save($file);
}
echo $homesCopy->nodeValue;
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.