xmlprinter is a simple, lightweight module to help write out XML documents, helping ensure proper quoting and balanced tags. The idea is grabbed from Perl's XML::Writer module.