[XML-SIG] an example of generating XML?

Fredrik Lundh fredrik@pythonware.com
Tue, 10 Sep 2002 14:36:16 +0200


martin wrote:

> then I recommend to add a method to class Node
>=20
>   def as_xml(self, id):
>     if self.ack:
>       ack =3D ' ack=3D"%s"' % self.ack
>     else:
>       ack =3D ''
>     return '<node id=3D"%d"%s>%s</node>' % (id, ack, self.text)

...and pray that nobody will ever pass in a string containing reserved
xml characters, or non-ascii data, or a unicode string...

</F>