I've been happy with lxml.builder which would look something like this:

from lxml.builder import E
doc = (
    E.author(
        E.name('Terry Pratchett'),
        E.genre('Fantasy/Comedy'),
        E.novels(
            E.novel('Small Gods', year="1992"),
            E.novel('The Fifth Elephant', year="1999"),
            E.novel("Guards! Guards!", year="1989"))))

Reply via email to