/// <summary>
/// 返回模板方法
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
private void getXmlContent(string strValue)
{
string strText = "";
//xml文件路径
string strFliePath = Server.MapPath("/Temple/TempleXMLFile.xml");
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(strFliePath);
XmlNodeList rootelement = xmldoc.DocumentElement.ChildNodes;//根节点
foreach (XmlElement element in rootelement) //父节点temple
{
if (element.Name.ToLower() == "temple")
{
XmlNodeList temple_nodelist = element.ChildNodes;
if (temple_nodelist.Count > 0)
{
foreach (XmlNode node in temple_nodelist)
{
if (node.Name.ToLower() == "temple_name" ) //取与选项相同的值
{
if (node.Attributes["Temple_Value"].Value == strValue) //strValue比对参数
{
XmlNode content_node = node.NextSibling;
if (content_node.HasChildNodes)
{
XmlNodeList nodeli = content_node.ChildNodes;
foreach (XmlNode mynode in nodeli)
{
strText += mynode.ChildNodes[0].Value + ":/n";
}
TextBox2.Text = strText;
}
else
{
TextBox2.Text = strText;
}
}
else
{
continue;
}
}
}
}
}
}
}