C# 获取XML节点的属性值

 1 XmlDocument doc = new XmlDocument();
 2                 doc.Load(HttpContext.Current.Server.MapPath("~/App_Data/" + xmlName + ".xml"));
 3                 XmlNodeList nodeList = doc.SelectNodes(xpath);
 4                 foreach (XmlNode sub in nodeList)
 5                 {
 6                     if (value.IndexOf(sub.Attributes["value"].Value) != -1)
 7                     {
 8                         value = sub.Attributes["value"].Value;
 9                     }
10                 }

 

posted @ 2012-07-12 10:23  看看天上云  阅读(1851)  评论(0编辑  收藏  举报