Question : Read XML through LINQ

Hi,
 i have a XML file. and i want to read this through LINQ. most of data in my xml file, in attribute field.
i googled over internet for this but did not find desire result.

My XML look like :-

File ID=331594

i want to show it in dataGrid view.
File ID=331595


Thanks in advance
Attachments:
 
Xml File
Xml File
 
 
 
 
XML File
 

Answer : Read XML through LINQ

I just made a small asp.net application and it worked for me. I just added a gridview with 2 bound columns (one bound to MainTitle and the other one bound to Title)

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
        protected void Page_Load(object sender, EventArgs e)
        {
            XDocument loaded = System.Xml.Linq.XDocument.Load(@"C:\test.xml");

            var q = from c in loaded.Descendants("Key").DescendantsAndSelf().Elements()
                    select new { MainTitle = c.Parent.Attribute("Title").Value, Title = c.Attribute("Title").Value };

            GridView1.DataSource = q.ToList();
            GridView1.DataBind();

        }
Random Solutions  
 
programming4us programming4us