HOWTO Avoid Being Called a Bozo When Producing XML. Excellent advice, particularly around character encoding.