Как прочитать атрибуты узла в XML? - C#
Формулировка задачи:
Подскажите пожалуйста, как правильно прочитать атрибуты узла?
Так не читает...
XmlDocument doc = new XmlDocument();
doc.Load(xmlFile);
XmlNodeList nodeList = doc.SelectNodes("//Sample/Analysis");
foreach (XmlNode node in nodeList)
{
string tgcode = node.Attributes.["TestGroupCode"].Value;
string tmcode = node.Attributes.["TestMethodCode"].Value;
string ananame = node.Attributes.["AnaName"].Value;
}Решение задачи: «Как прочитать атрибуты узла в XML?»
textual
Листинг программы
foreach (XmlElement el in nodeList)
{
string tgcode = el.GetAttribute("TestGroupCode"),
tmcode = el.GetAttribute("TestMethodCode"),
ananame = el.GetAttribute("AnaName");
}