I've been using XML::Writer for 3 years now and it works very well for my needs; it cannot convert data structures to XML, but it is perfect if you want to compose XML programmatically; its capability of pretty printing is configurable; a good module in my opinion!