xml操作

loadxml

XmlDocemnt xmlDoc=new XmlDocument();

XmlDoc.LoadXml("路径");

XmlElement rootElement=xmlDoc.DocumentElement;

XmlNodeList dataList=rootElemnt.SelecteNodes("'/student/name");//节点下的路径

Hashtable hsXML = new Hashtable();

foreach(XmlNode xn in dataList)

{

         if (!hsXML.ContainsKey(xn.Attributes["FieldName"].Value.Trim()) && xn.Attributes["Value"] != null)
                    {
                        hsXML.Add(xn.Attributes["FieldName"].Value.Trim(), xn.Attributes["Value"].Value.Trim());
                    } 

}

原文地址:https://www.cnblogs.com/sxjljj/p/8544433.html