Elementtree and CDATA handling
fredrik at pythonware.com
Wed Jun 1 15:33:58 CEST 2005
alainpoint at yahoo.fr wrote:
> There are two problems: the //<![CDATA[ has disappeared and the <, >
> and && have been replaced by their equivalent entities (CDATA should
> have prevented that).
> I am no XML/HMTL expert, so i might be doing something wrong...
you're confusing the external representation of something with the internal
>>> "hell" + "o"
>>> 'h' 'e' 'l' 'l' 'o'
the above are six ways to write the same string literal in Python. all these result
in a five-character string containing the letters "h", "e", "l", "l", and "o". if you type
the above at a python prompt, you'll find that Python echoes the strings back as
'hello' in all six cases.
in XML, entities, character references, and CDATA sections are three different
way to represent reserved characters. once you've loaded the file, they all "dis-
More information about the Python-list