PHP: XMLWriter->writeCData() - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

XMLWriter->writeComment() XMLWriter->writeAttribute()

Last updated: Fri, 26 Jan 2007

view this page in

# XMLWriter->writeCData()

(no version information, might be only in CVS)

XMLWriter->writeCData() -- Write full CDATA tag

## Описание

Object oriented style:

class XMLWriter {
bool writeCData ( string content )
}

Procedural style:

bool xmlwriter_write_cdata ( resource xmlwriter, string content )

Writes a full CDATA.

## Список параметров

`xmlwriter`

  Only for procedural calls. The XMLWriter resource that is being modified. This resource comes from a call to xmlwriter_open_uri() or xmlwriter_open_memory().

`content`

  The contents of the CDATA.

## Возвращаемые значения

Возвращает `TRUE` в случае успешного завершения или `FALSE` в случае возникновения ошибки.

## Смотрите также

XMLWriter->startCData()
XMLWriter->endCData()

add a note User Contributed Notes
XMLWriter->writeCData()
dave at dtracorp dot com
06-Mar-2007 01:30
`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`
add a note
XMLWriter->writeComment() XMLWriter->writeAttribute()

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST