码迷,mamicode.com
首页 > 其他好文 > 详细

xml数据改动

时间:2014-08-25 18:54:54      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   os   for   数据   div   log   

     public void  reXml ( string namepngname  )
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(_xmlpath);
           /*XmlNodeList  lis =   doc.GetElementsByTagName("string");
            foreach ( XmlNode  u in lis)
            {
                //Debug.WriteLine(u.InnerText.ToString());
                if (u.InnerText.ToLower().Length > 6)
                {
                    if ((u.InnerText.ToLower()).Substring(0, 5) == "output")
                    {
                        u.InnerText = namepngname;
                    }
                }

            }
            Debug.WriteLine(doc.OuterXml);
            */
            XmlNode root = doc.DocumentElement;
          
            XmlNodeList  cbo = root["dict"].LastChild.ChildNodes;
            foreach ( XmlNode cc in cbo )
            {
                if (cc.InnerText.ToLower().Length >6)
                {
                    if ((cc.InnerText.ToLower()).Substring(0, 6) == "output")
                    {
                       // Debug.WriteLine(cc.InnerText);
                        cc.InnerText = namepngname;
                    }
                    //Debug.WriteLine(cc.InnerText.ToLower().Substring(0, 5));
                }

                //Debug.WriteLine(cc.InnerText);
            }

            doc.Save(_xmlpath);

 

xml数据改动

标签:des   style   blog   color   os   for   数据   div   log   

原文地址:http://www.cnblogs.com/gaitian00/p/3935513.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!