convert the .txt file in to .Xml

sumanthan

New member
Joined
Jan 29, 2013
Messages
3
Programming Experience
Beginner
I need to convert the .txt file in to .Xml file using c#, I can only able to convert half of the text, But I needed to convert in to a readable xml file containing its roots ant its each child elements.
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace Creating_Text_File_Using_Xml
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            XmlTextWriter XTW = new XmlTextWriter("savefile.xml", Encoding.Unicode);
            XTW.WriteStartDocument();
            XTW.WriteStartElement("XMLFILE");
            XTW.WriteStartElement("Title");
            XTW.WriteString(textBox1.Text);
            XTW.WriteEndElement();
            foreach(String item in listBox1.Items)
            {
                 XTW.WriteStartElement("Item");
                 XTW.WriteString(item);
                 XTW.WriteEndElement();
            }
            XTW.WriteEndElement();
            XTW.WriteEndDocument();
            XTW.Close();

        }
    }
}

This is the file i am trying to convert!!!!
http://www.2shared.c...V1611Bible.html
These are the words should be excluded from the file
http://www.2shared.c...x9/exclude.html
 
Back
Top Bottom