Generalized header XML writer. Added comments.