xml:
<?xml version="1.0" encoding="utf-8" ?>
<StudentList>
<student>
<name>Ram</name>
<Id>1</Id>
</student>
<student>
<name>Hari</name>
<Id>2</Id>
</student>
<student>
<name>Gita</name>
<Id>3</Id>
</student>
<student>
<name>Sita</name>
<Id>4</Id>
</student>
</StudentList>
页: 1
XmlDocument XD = new XmlDocument();
XD.Load(System.Web.HttpContext.Current.Server.MapPath("XmlFile.xml"));
XmlNodeList nodeListName = XD.GetElementsByTagName("student");
foreach (XmlNode xNode in nodeListName)
{
foreach (XmlElement xelement in xNode)
{
PlaceHolder pshd = new PlaceHolder();
LblDisplay.Text += xelement.FirstChild.Value + " ";
string Name += xelement.FirstChild.Value;
}
LblDisplay.Text += "<br/>";
}
i 只想从上述xml档案中收集名字,而要获得姓名和复制。 怎么能够做,就会帮助。