ANN: XML builder for Python

Jonas Galvez jonas at codeazur.com.br
Thu Jul 3 22:30:22 EDT 2008


Walter Dörwald wrote:
> Of course the node constructor could append the
> node to the currently active element. However there
> might be cases where you want to do something else
> with the newly created node, so always appending the
> node is IMHO the wrong thing.

Unless you're using it as a templating engine of sorts, much like
Ruby's builder used in Rails.

Which is exactly what I'm trying to get at. I don't want to store the
tree in any way or be able to modify it afterwards, I just want to
generate the XML as the block is executed. Using ElementTree as
suggested previously might be a good solution if you want to preserve
what you've generated, tho.

--Jonas Galvez



More information about the Python-list mailing list