public string GetAttribValue(string node, string name)
{
XmlNodeList xmln = GetEntries(node);
for (int k = 0; k < xmln.Count; k++)
{
for (int i = 0; i < xmln[k].Attributes.Count; i++)
{
if (xmln[k].Attributes[i].Name == name)
{
return xmln[0].Attributes[i].InnerText;
}
}
}
return "";
}
public System.Xml.XmlNodeList GetEntries(string param)
{
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(_configFile);
System.Xml.XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Configuration/" + param);
return xmlNodes;
}
Get XML attribute value in C#
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment