From your code, xml file was not loading to
doc object and secondly you are getting error due to root element. Please try with below code:
Document doc = XDocument.Load(xmlfilename);
string temp = textBox1.Text + doc.Root.Element("setting2").Value;
string temp = textBox1.Text + doc.Element("settings").Element("setting2").Value;