楼主你应该把xml用文字的形式发送上来,那样的话大家猜可以拷贝你的xml中的内容来帮你完成你的程序。

解决方案 »

  1.   

    public class XmlProvider : IDisposable
        {
            private string a;
            private XmlDocument b;        public XmlProvider(string XmlFile)
            {
                try
                {
                    this.b = new XmlDocument();
                    this.b.Load(XmlFile);
                }
                catch
                {
                }
                this.a = XmlFile;
            }        public void DeleteNode(string NodeName)
            {
                string xpath = NodeName.Substring(0, NodeName.LastIndexOf("/"));
                this.b.SelectSingleNode(xpath).RemoveChild(this.b.SelectSingleNode(NodeName));
            }        public void Dispose()
            {
                this.Dispose(true);
            }        protected void Dispose(bool Diposing)
            {
                this.b = null;
            }        public void InsertElement(string mainNode, string element, string content)
            {
                XmlNode node = this.b.SelectSingleNode(mainNode);
                XmlElement newChild = this.b.CreateElement(element);
                newChild.InnerText = content;
                node.AppendChild(newChild);
            }        public void InsertElement(string mainNode, string element, string attrib, string attribContent, string content)
            {
                XmlNode node = this.b.SelectSingleNode(mainNode);
                XmlElement newChild = this.b.CreateElement(element);
                newChild.SetAttribute(attrib, attribContent);
                newChild.InnerText = content;
                node.AppendChild(newChild);
            }        public void InsertNode(string mainNode, string childNode, string element, string content)
            {
                XmlNode node = this.b.SelectSingleNode(mainNode);
                XmlElement newChild = this.b.CreateElement(childNode);
                node.AppendChild(newChild);
                XmlElement element3 = this.b.CreateElement(element);
                element3.InnerText = content;
                newChild.AppendChild(element3);
            }        public string ReadAttribute(string PathNode, string AttributeName)
            {
                string str = "";
                try
                {
                    str = this.b.SelectSingleNode(PathNode).Attributes[AttributeName].Value;
                }
                catch
                {
                    Responses.Write(PathNode);
                    Responses.End();
                }
                return str;
            }        public string ReadInnerText(string PathNode)
            {
                return this.b.SelectSingleNode(PathNode).InnerText;
            }        public XmlNode ReadNode(string PathNode)
            {
                return this.b.SelectSingleNode(PathNode);
            }        public void Save()
            {
                try
                {
                    this.b.Save(this.a);
                }
                catch
                {
                }
                this.b = null;
            }        public void UpdateAttribute(string PathNode, string AttributeName, int AttributeValue)
            {
                this.b.SelectSingleNode(PathNode).Attributes[AttributeName].Value = AttributeValue.ToString();
            }        public void UpdateAttribute(string PathNode, string AttributeName, string AttributeValue)
            {
                this.b.SelectSingleNode(PathNode).Attributes[AttributeName].Value = AttributeValue;
            }        public void UpdateInnerText(string PathNode, string InnerText)
            {
                this.b.SelectSingleNode(PathNode).InnerText = InnerText;
            }
        }
      

  2.   

    xml文件内容太多了
    就折叠出来了