elementtree -

Jesper Olsen jolsen at despammed.com
Sun Oct 3 06:29:10 EDT 2004


Hi,

I'm using the XMLWriter from the effbot element tree module:
http://effbot.org/zone/xml-writer.htm

I'd like to output the element "<span> </span>"
and I try this

w=XMLWriter(f)
w.element("span", " ", id="txt")

But that does not work because " " gets escaped to "&nbsp;"
- and using " " does not work either because space does not get
escaped...
Is there a way to do this?

Another thing I noticed is when outputting the element

<meta http-equiv="content-type" content="text/html" />

then is not possible to generate this by passing attributes as
keywords
to the w.element method - so it is necessary to use the slightly less
elegant form

w.element("meta", None, {"http-equiv":"contenttype",
"content":"text/html"})

I guess there is no way to avoid this - since the module relies on
pythons
way of handling keyword parameters...

/Jesper



More information about the Python-list mailing list