111,130
社区成员
发帖
与我相关
我的任务
分享
static string Search()
{
string author="";
XmlDocument doc = new XmlDocument();
doc.Load(@"你XML文件的路径");
XmlNodeList nodelist = doc.SelectSingleNode("book").ChildNodes;
foreach (XmlNode xn in nodelist)
{
string name = node.SelectSingleNode("name").InnerText;
if(name.equal("jim"))
{
author= node.SelectSingleNode("author").InnerText;
}
}
return author;
}