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