C# 操作xml文件

  /// <summary>
        /// 修改XML
        /// </summary>
        /// <param>test</param>
        public static void ChangeXml(string test)
        {
            string xmlPath = "config";//当前文件夹下的config
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlPath);
            XmlNodeList settings = xmlDoc.SelectNodes("configuration/applicationSettings/setting");
            foreach (XmlNode node in settings)
            {
                XmlNode valueNode = node.SelectSingleNode("value");
                string[] uri = valueNode.InnerText.Split(‘/‘);
                valueNode.InnerText = "http://" + test + "/" + uri[uri.Length - 1];
            }
            xmlDoc.Save(configPath);
        }

C# 操作xml文件

上一篇:Ubuntu学习笔记-win7&Ubuntu双系统简单搭建系统指南


下一篇:MVC中apicontroller session为空的解决办法