引用:http://topic.csdn.net/u/20080311/16/358d97b9-1e56-4925-aea0-43f9734b3e03.html

foreach (XmlNode xn in nodeList)//遍历所有子节点
{ XmlElement xe = xn as XmlElement;//最好不好用强制转换,建议使用as,这样如果转不过去话,就是null,不会报异常if(xe!=null) //这样判断以下是否为null,或者你可以if(xe==null) return ;直接返回或做其他处理
{ Keyname = xe.Attributes["key"].InnerXml;//键值 switch (Keyname)
{ case"SiteName": xe.Attributes["value"].Value =this.txtSiteName.Text; break; case"Sitecontent": xe.Attributes["value"].Value =this.txtDescription.Text; }
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-09-07
  • 2021-07-02
  • 2022-12-23
猜你喜欢
  • 2021-06-28
  • 2022-12-23
  • 2021-11-22
  • 2021-06-22
  • 2022-12-23
  • 2022-01-22
  • 2021-04-15
相关资源
相似解决方案