XmlDocument 在C#中有什么作用呢

public static string GetValue(string AppKey)
{
//实例化xml解析器对象
System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
//加载文档
xDoc.Load(System.Windows.Forms.Application.StartupPath + "/user.config");
//xml文档中的单个字节
System.Xml.XmlNode xNode;
//元素
System.Xml.XmlElement xElem1;
//选择configuration第一个字节
xNode = xDoc.SelectSingleNode("//configuration");

        xElem1 = (System.Xml.XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
        if (xElem1 != null)
        {
            //获取指定名称特新的值
            return xElem1.GetAttribute("value");
        }
        else
        {
            return "";
        }

    }

有了它,你才能load一个xml文档,你才能从它出发,去读写xml文档。

代表一个xml文档对象。

打个比方,结合webservice使用时,xmldocument类可以看做是一辆车,你把xml文件或字符串放进车里,然后让他通过webservice这条路去目的地把你要的东西取来,如果取回来的是xml类型的结果,那你就要用这个类极其方法来将该xml每个节点的内容拿出来