栀子花开

追求完美

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

            XmlDocument xmldoc = new XmlDocument();
            StreamReader sr = new StreamReader(System.Configuration.ConfigurationManager.AppSettings["OperationDefinitionsFile"]);
            xmldoc.LoadXml(sr.ReadToEnd());
            XmlNode root = xmldoc.SelectSingleNode("OpenBoxMethods");
            XmlNodeList xn = xmldoc.SelectNodes("//OpenBoxMethods/method");
            foreach (XmlNode no in xn)
            {
                if (ops.Contains(no.Attributes["name"].Value.Trim()))
                    root.RemoveChild(no);
            }
           // xmldoc.SelectSingleNode(
            sr.Close();
            sr = null;


            StreamWriter sw = new StreamWriter(
            System.Configuration.ConfigurationManager.AppSettings["OperationDefinitionsFile"], false);
            sw.WriteLine(xmldoc.OuterXml);
            sw.Close();

posted on 2007-10-23 11:18  杨林  阅读(180)  评论(0编辑  收藏  举报