c#如何读取xml节点的数据并且赋值给界面的label标签??? 急!!!菜鸟在线等待!
xml如下:<items><itempeopleNo="开会应到人数"date="当前日期"timeStart="开始时间"timeEnd="结束始时间"><people...
xml 如下:
<items>
<item peopleNo="开会应到人数" date="当前日期" timeStart="开始时间" timeEnd="结束始时间">
<peopleNo>88</peopleNo>
<date>2013-3-17</date>
<timeStart>2:01:09</timeStart>
<timeEnd>5:00:00</timeEnd>
</item>
</items> 展开
<items>
<item peopleNo="开会应到人数" date="当前日期" timeStart="开始时间" timeEnd="结束始时间">
<peopleNo>88</peopleNo>
<date>2013-3-17</date>
<timeStart>2:01:09</timeStart>
<timeEnd>5:00:00</timeEnd>
</item>
</items> 展开
展开全部
string xml = "<items> <item peopleNo=\"开会应到人数\" date=\"当前日期\" timeStart=\"开始时间\" timeEnd=\"结束始时间\"> <peopleNo>88</peopleNo> <date>2013-3-17</date> <timeStart>2:01:09</timeStart> <timeEnd>5:00:00</timeEnd> </item></items>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNode node = doc.SelectSingleNode("items/item");
string pno=node.Attributes["peopleNo"].Value;
string pnoValue = doc.SelectSingleNode("items/item/peopleNo").InnerText;
Label1.Text = pno;
Lable2.Text = pnoValue;
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNode node = doc.SelectSingleNode("items/item");
string pno=node.Attributes["peopleNo"].Value;
string pnoValue = doc.SelectSingleNode("items/item/peopleNo").InnerText;
Label1.Text = pno;
Lable2.Text = pnoValue;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询