日期:2014-05-18 浏览次数:20676 次
string xml=@"<?xml version=""1.0"" encoding=""utf-16""?> <MapView xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" Id=""34""> <Devices> <DeviceView Id=""34000000-0000-0000-0011-000000000001"" Left=""1223.493408203125"" Top=""403.00531005859375"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000002"" Left=""1180.7918701171875"" Top=""425.95571899414062"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000118"" Left=""244.87860107421875"" Top=""358.30874633789062"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000119"" Left=""230.990234375"" Top=""363.33819580078125"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000120"" Left=""1335.5994873046875"" Top=""790.2198486328125"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000121"" Left=""633.4530029296875"" Top=""31.482200622558594"" Angle=""0"" /> <DeviceView Id=""34000000-0000-0000-0011-000000000122"" Left=""561.5120849609375"" Top=""28.622438430786133"" Angle=""0"" /> </Devices> </MapView>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); foreach (XmlNode node in doc.SelectNodes("MapView/Devices/DeviceView")) { Console.Write(node.Attributes["Id"].Value + "\t"); Console.Write(node.Attributes["