Page 1 of 1

DOMDocument doesn't save

Posted: Tue Mar 10, 2009 6:22 am
by jamesm6162
Hi All.

I have run into a really strange problem.

I load a DOMDocument from file and then edit some of the elements

Code: Select all

//$temp is some element in the DOMDocument called $doc
$t = $tmp->getElementsByTagName("title")->item(0);          
$de = $tmp->getElementsByTagName("description")->item(0);
$da = $tmp->getElementsByTagName("date")->item(0);
$img = $tmp->getElementsByTagName("image")->item(0);
            
$t->nodeValue = $title;
$de->nodeValue = $description; //Long text value, may contain special characters
$da->nodeValue = $dstring;

The description I am trying to add in the above event does not get saved at all when I call $doc->save($filename) or $doc->saveXML().

When I call saveXML() the <description> tag is empty, however when I call $doc->textContent, the entire text value is displayed correctly.

What could be causing this problem?

Thanks.