XMLWriter allows you to generate well-formed XML documents using an API based on Seaside's canvas and tag brushes so all tags will be nested properly and not left unclosed.
For additional info and examples:
http://montyos.wordpress.com