xml generator that uses the with statement

Here is a quick and dirty draft of a xml generator that uses the with statement: http://twoday.tuwien.ac.at/pub/files/XmlMarkup (ZIP, 3 KB) It is inspired by rubies XmlMarkup class. Brief usage:
I'm not 100% sure about some parts of the 'syntax', though. E.g. maybe change this:
into this:
This Syntax is more concise than those unhandy and error prone beginElement/endElement calls (endElement needs the name as argument, too!). This way you never forget to close a tag again. :) It even provides a simple way to embed arbitrary data:
And I added a way to generate DTDs:
What do you think? :) -panzi

Mathias Panzenböck wrote:
[...]
What do you think? :)
-panzi
Something similar, but without namespace handling: http://article.gmane.org/gmane.comp.python.general/579900/ (I like that you have a class called 'maybe' :-) Regards Ger

Hm, it seems that there are a lot of similar xml generators. I think one of them should be included in the python standard library. I'd say the one that 1. handles the xml standard best and 2. has the "best" (most concise, handy and complete) API. Hmm. There should be some kind of contest. :) -panzi

Mathias Panzenböck wrote:
[...]
What do you think? :)
-panzi
Something similar, but without namespace handling: http://article.gmane.org/gmane.comp.python.general/579900/ (I like that you have a class called 'maybe' :-) Regards Ger

Hm, it seems that there are a lot of similar xml generators. I think one of them should be included in the python standard library. I'd say the one that 1. handles the xml standard best and 2. has the "best" (most concise, handy and complete) API. Hmm. There should be some kind of contest. :) -panzi
participants (4)
-
Gerard flanagan
-
Josiah Carlson
-
Mathias Panzenböck
-
Stefan Behnel