xml数据改动

     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);

 

posted on 2014-08-25 17:44  盖天00  阅读(164)  评论(0编辑  收藏  举报

导航