[lxml-dev] Re: Encapsulating text in CDATA
Fredrik Lundh
fredrik at pythonware.com
Tue Dec 27 15:02:49 CET 2005
Matias wrote:
> How can I use CDATA blocks to encapsulate text?
> I try to add the CDATA identifiers manually, but it doesn't work.
> Is there a way to do this? I didn' t find anything anything about this on
> the lxml library documentation. I've just found that the libxml has a
> function to do this xmlNewCDataBlock, but i didn't find a wrapper for the
> ElementTree api.
The ElementTree information model is based on the XML infoset, and "CDATA
blocks" simply don't exist in the infoset model. They're a file encoding thing, not
an information model thing.
Or in other words, if you think you need them, you're wrong, or you're not really
using XML, and CDATA won't solve your problems. Some related reading:
http://www.w3.org/TR/xml-infoset/#omitted
http://www.hixie.ch/advocacy/xhtml
http://lesscode.org/projects/kid/ticket/99 (read the comments)
</F>
More information about the lxml-dev
mailing list