But i cant figure out how to read only the name of the autor.
very basic xml question.
I have an ini that looks like this:
Pride And Prejudice1 the autors name 19.95
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kevin AungPosted Jan 6, 2011, 9:22 PM
using System;
using System.Xml.Linq;
using System.Xml.Xpath;
static void Main()
{
string xmlPath = @"C:\temp\books.xml";
string bookVal = "";
XDocument xDoc = XDocument.Load(xmlPath);
XElement xAuthor = xDoc.XPathSelectElement("book/author");
if (xAuthor != null)
bookVal = xAuthor.Value;
}