SelectNodes
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(Server.MapPath("~/App_Data/Navigator.xml"));
System.Xml.XmlNodeList nodes = doc.SelectNodes("/navigator/item");
for (int i = 0; i < nodes.Count; i++)
{
string title = nodes[i].Attributes["title"].Value;
// ...
}
SelectSingleNode
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(xmlString);
string docTitle = doc.SelectSingleNode("//docTitle").InnerText;
相关阅读