note 84844 added to simplexml.examples
| From: | bbroerman at bbroerman dot net | Date: | Fri, 01 Aug 2008 16:31:42 +0000 |
| Subject: | note 84844 added to simplexml.examples | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143015@lists.php.net to get a copy of this message | ||
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!
----
Server IP: 64.71.164.2
Probable Submitter: 206.126.170.20
----
Manual Page -- http://www.php.net/manual/en/simplexml.examples.php
Edit -- https://master.php.net/note/edit/84844
Del: integrated -- https://master.php.net/note/delete/84844/integrated
Del: useless -- https://master.php.net/note/delete/84844/useless
Del: bad code -- https://master.php.net/note/delete/84844/bad+code
Del: spam -- https://master.php.net/note/delete/84844/spam
Del: non-english -- https://master.php.net/note/delete/84844/non-english
Del: in docs -- https://master.php.net/note/delete/84844/in+docs
Del: other reasons-- https://master.php.net/note/delete/84844
Reject -- https://master.php.net/note/reject/84844
Search -- https://master.php.net/manage/user-notes.php