note 84844 rejected from simplexml.examples by danbrown
| From: | danbrown@php.net | Date: | Fri, 01 Aug 2008 16:32:45 +0000 |
| Subject: | note 84844 rejected from simplexml.examples by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143016@lists.php.net to get a copy of this message | ||
Note Submitter: bbroerman at bbroerman dot net
----
How about assigning an inner text to a node where the new text contains CDATA? It is transforming
the entities:
$newComment = "![CDATA[" . html_entity_decode($_POST['imgcaption']) .
"]]";
$xml->Image[$index]->Comment = $newComment;
This example code is to add an HTML caption to an image definition in an XML document. The entities
are still htmlencoded in the output XML.
I tried it both with and without the CDATA wrapper strings, and it doesn't seem to matter. It
is still encoding the strings. I verified that the actual data being placed into the comment is not
encoded.
Thanks!