xml内容如下:
:<?xml version="1.0" encoding="GBK" ?><SystemConfig Name="Config">       <Font>微软雅黑</Font>       <Color>400000</Color>       <Size>12</Size>       <A>字体效果</A></SystemConfig>例如我要修改Size的内容,怎样写.
读取xml,或者修改节点属性例如<SystemConfig Name="Config">方法已有.
对xml不熟识,求高手解答

解决方案 »

  1.   

    修改public static void Update(string path, string node, string attribute, string value)
            {
                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(path);
                    XmlNode xn = doc.SelectSingleNode(node);
                    XmlElement xe = (XmlElement)xn;
                    if (attribute.Equals(""))
                    {
                        xe.InnerText = value;
                    }
                    else
                    {
                        xe.SetAttribute(attribute, value);
                    }
                    doc.Save(path);
                }
                catch { }
            }