note 73665 deleted from function.xmlwriter-write-cdata by cmb
| From: | cmb@php.net | Date: | Sun, 20 Sep 2020 16:42:13 +0000 |
| Subject: | note 73665 deleted from function.xmlwriter-write-cdata by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215165@lists.php.net to get a copy of this message | ||
Note Submitter: dave at dtracorp dot com
----
i don't know if this is a bug with the underlying c code or not, or this is by design (i'm
not a big xml guy), but for me, running on fedora core 5, php 5.2.1
to get this to work, the cdata functions need to wrap the description (or whatever element the cdata
should appear in)
for example.
// initiate xmlwriter object as $xw
// add header, titles, etc.
// start cdata
$xw->startCData();
// start description
$xw->startElement('description');
// write cdata
$xw->writeCData('<img src="http://php.net/images/php.gif" />');
// write the description contents
$xw->text('php logo');
// end the description element
$xw->endElement();
// end the cdata
$xw->endCData();
// end xml, and output
otherwise, i just got warnings about writing cdata in the wrong context, and no cdata would be
written