XML generation
Thomas Guettler
pan-newsreader at thomas-guettler.de
Thu Mar 27 15:45:45 EST 2003
On Thu, 27 Mar 2003 07:19:43 +0100, Basalingamma wrote:
> HAI,
>
> How can I generate xml by extracting Zope's ZCLASS instances
> properties.
I think it could be done like this:
import cgi
def generateXML(self):
e=cgi.escape
props=[]
for (key, item) in self._properties.items():
props.append('<property name="%s">%s</property>' % (e(key),e(item))
return('''<?xml version="1.0"?>
<root>%</root>
''' % ''.join(props))
But maybe cgi can't be imported with ZClasses. I don't like them,
you could try programming real python products.
thomas
--
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de
More information about the Python-list
mailing list