日期:2014-05-18  浏览次数:20489 次

相对路径读取XML。。
在项目中添加一个XML文件,,

如何通过C#对该XML文件进行读取??

要用相对路径吧,,可以给出读取方法的代码吗???

------解决方案--------------------
XmlDocument doc= new XmlDocument();
doc.Load(System.Windows.Forms.Application.StartupPath + ("/1.xml"));
XmlNode node = doc.SelectSingleNode("//a");
if (node != null)
{
string str= node.InnerText;
}
XmlNodeList nodelist= doc.SelectNodes("");
int i;
for (i = 0; i < nodelist.Count; i++)
{
XmlElement root = doc.DocumentElement;

}