This is the code:-
public void TestXmlDocument()
{
StringBuilder output = new StringBuilder();
XDocument document = XDocument.Load("XmldataList.xml");
#region Fetch All the Books
var books = from r in document.Descendants("book")
select new
{
Author = r.Element("author").Value,
Title = r.Element("title").Value,
Genere = r.Element("genre").Value,
Price = r.Element("price").Value,
PublishDate = r.Element("publish_date").Value,
Description = r.Element("description").Value,
};
foreach (var r in books)
{
Label3.Text=r.PublishDate + r.Title + r.Author;
}
Console.ReadKey(true);
#endregion
}
I am getting error that
Exception Details: System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\XmldataList.xml'.
At line-
XDocument document = XDocument.Load("XmldataList.xml");