XmlDocument xd = new XmlDocument();
xd.Load(@"C:\Documents and Settings\Administrator\桌面\book.xml");//此处替换为你的虚拟xml
List<string> list = new List<string>();
foreach (XmlNode node in xd.SelectNodes("//Control"))
{ list.Add(node.InnerText); }
xd.Load(@"C:\Documents and Settings\Administrator\桌面\book.xml");//此处替换为你的虚拟xml
List<string> list = new List<string>();
foreach (XmlNode node in xd.SelectNodes("//Control"))
{ list.Add(node.InnerText); }
System.Xml.XmlDocument document = new System.Xml.XmlDocument();
document.InnerXml = @"<Display>
<found>
<Control> lbl_Test </Control>
<Type> Lable </Type>
<Text> 程序 </Text>
</found>
<found>
<Control> txt_Test </Control>
<Type> TextBox </Type>
<Text> TextBox </Text>
</found>
</Display>
";
System.Xml.XmlNodeList nl = document.SelectNodes(@"//Control");
foreach (System.Xml.XmlNode n in nl)
{
Console.WriteLine(n.InnerText);
}
document.LoadXml(@"<Display>
<found>
<Control> lbl_Test </Control>
<Type> Lable </Type>
<Text> 程序 </Text>
</found>
<found>
<Control> txt_Test </Control>
<Type> TextBox </Type>
<Text> TextBox </Text>
</found>
</Display>
";
System.Xml.XmlNodeList nl = document.SelectNodes(@"//Control");
foreach (System.Xml.XmlNode n in nl)
{
Console.WriteLine(n.InnerText);
}
doc.Load(Server.MapPath("path"));
XmlNode root = doc.SelectSingleNode("Display");
XmlNodeList ele = root.SelectNodes("found/Control");
foreach (XmlNode node in ele)
{
Response.Write(node.InnerText+"<br>");
}