Jump to content

DOM document does not save


jamesm6162

Recommended Posts

Hi All.

 

I have run into a really strange problem.

 

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

 

//$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.

Link to comment
https://forums.phpfreaks.com/topic/148747-dom-document-does-not-save/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.