note 73665 added to function.xmlwriter-write-cdata
| From: | dave at dtracorp dot com | Date: | Tue, 06 Mar 2007 09:30:13 +0000 |
| Subject: | note 73665 added to function.xmlwriter-write-cdata | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124139@lists.php.net to get a copy of this message | ||
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
----
Server IP: 203.220.0.234
Probable Submitter: 211.28.148.222
----
Manual Page -- http://www.php.net/manual/en/function.xmlwriter-write-cdata.php
Edit -- https://master.php.net/note/edit/73665
Del: integrated -- https://master.php.net/note/delete/73665/integrated
Del: useless -- https://master.php.net/note/delete/73665/useless
Del: bad code -- https://master.php.net/note/delete/73665/bad+code
Del: spam -- https://master.php.net/note/delete/73665/spam
Del: non-english -- https://master.php.net/note/delete/73665/non-english
Del: in docs -- https://master.php.net/note/delete/73665/in+docs
Del: other reasons-- https://master.php.net/note/delete/73665
Reject -- https://master.php.net/note/reject/73665
Search -- https://master.php.net/manage/user-notes.php