日期:2014-05-18 浏览次数:21062 次
string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><tags><tag tagnumber=\"1\"><epc>038604c02010460000394bc9</epc><time>2012-6-26 10:56:42 +08:00</time></tag><tag tagnumber=\"2\"><epc>038604c02010460000394bbe</epc><time>2012-6-26 10:56:42 +08:00</time></tag><tag tagnumber=\"3\"><epc>038604c02010460000394bc6</epc><time>2012-6-26 10:56:42 +08:00</time></tag></tags>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); XmlNodeList list = xmlDoc.SelectNodes("tags/tag"); DateTime[] array = new DateTime[list.Count]; for (int i = 0; i < list.Count; i++) { array[i] = DateTime.Parse(list[i].SelectSingleNode("time").InnerText); }