1
willerce 2011-12-19 13:48:20 +08:00
上 cnblogs 搜索 xml
|
2
n0th1ng 2011-12-19 14:21:10 +08:00
我还以为到了SO,话说最近各种 .net
|
3
shanderlam 2011-12-19 20:21:14 +08:00
rdrXml.Attributes?
|
4
vonsy 2011-12-19 20:25:25 +08:00
节选:
string xmlFilePath = @"X:\about.net\example\XmlExample\1.xml"; XmlDocument doc = new XmlDocument(); doc.Load(xmlFilePath); //使用xpath表达式选择文档中所有的student子节点 XmlNodeList studentNodeList = doc.SelectNodes("/students/student"); if (studentNodeList != null) { foreach (XmlNode studentNode in studentNodeList) { //通过Attributes获得属性名字为name的属性 string name = studentNode.Attributes["name"].Value; 来源: http://www.cnblogs.com/yukaizhao/archive/2011/07/19/csharp_xmldocument_access_xml.html http://www.cnblogs.com/yukaizhao/archive/2011/07/21/linq-to-xml.html |