zoukankan      html  css  js  c++  java
  • 给xml|web.config 增加节点和属性值

    给xml|web.config 增加节点和属性值  

    string basePathConfig = this.Request.PhysicalApplicationPath.ToString()+"Web.config";
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(basePathConfig); //加载你的XML文件
                XmlNode appSettings = xmlDoc.SelectSingleNode("/configuration/appSettings");//查找appSettings
                XmlElement adds=xmlDoc.CreateElement("add");//创建add节点
                adds.SetAttribute("key","test");
                adds.SetAttribute("value","testvalue");
                appSettings.AppendChild(adds);   //追加节点        
                xmlDoc.Save(basePathConfig);//保存文件
                Response.Write("success");成功提示

  • 相关阅读:
    *HDU 1392 计算几何
    *HDU 1115 计算几何
    *HDU 1086 计算几何
    *HDU 2108 计算几何
    HDU 1528 贪心模拟/二分图
    HDU 1281 二分图
    *HDU1150 二分图
    *HDU1151 二分图
    *HDU 1068 二分图
    *HDU 1054 二分图
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835513.html
Copyright © 2011-2022 走看看