Changed StreamWriter to XmlTextWriter