Reputation: 4200
I want to get the node by his name and not by his item id, at the moment i have this:
XmlNode xmlNodoDebug = docWebConfig.DocumentElement.SelectSingleNode("system.web/compilation");
Response.Write(xmlNodoDebug.Attributes.Item(1).Value); // returns value "true"
My XML is the Web.Config of other C# projects:
<compilation defaultLanguage="c#" debug="true" />
I want to get the value of that node by his name, "debug".
Upvotes: 1
Views: 486
Reputation: 24177
Yes, just use the indexer which accepts a string index: http://msdn.microsoft.com/en-us/library/1b823yx9.aspx
XmlAttribute attribute = xmlNodoDebug.Attributes["debug"];
Upvotes: 1