Another way of reading a text file and saving it to an Xml is to load the text file using OleDbCommand/OleDbConnection into a DataTable then use the WriteXml method of the DataTable:
OleDbConnection oleDbConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\YourFolder\;Extended
Properties=""text;HDR=no;FMT=Delimited""")
OleDbCommand oleDbCommand = new ("SELECT * FROM [YourTextFile.txt]", oleDbConnection);
DataTable dataTable = new DataTable("YourData");
OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(oleDbCommand);
oleDbDataAdapter.Fill(dataTable);
dataTable.WriteXml("YourXmlFile.xml");
Regards,
SQL Server Helper