如何读取的xml
如何读取这样的xml,每个item要分开,返回
1;2;3;4
5;6;7;8
xml文件:
<inf>
<item>
<email> 1; </email>
<password> 2; </password >
<passwordQuestion > 3; </passwordQuestion >
<passwordAnswer> 4; </passwordAnswer>
</item>
<item>
<email> 5; </email>
<password> 6; </password >
<passwordQuestion > 7; </passwordQuestion >
<passwordAnswer> 8; </passwordAnswer>
</item>
</inf>
------解决方案--------------------#region 读取xml
public string ShowConfigInfo(string key)
{
XmlDocument xd=new XmlDocument();
xd.Load(Server.MapPath( "a.xml "));
XmlNodeList xnl = xd.GetElementsByTagName(key);
if(xnl.Count==0)
{
return " ";
}
else
{
XmlNode mNode=xnl[0];
return mNode.InnerText;
}
}