private List<TourXML> ReadXML1() { XmlDocument m_XmlDoc = new XmlDocument(); m_XmlDoc.Load(Server.MapPath(".") + "\\TourName1.xml"); XmlNodeList NodTours = m_XmlDoc.SelectNodes("TourInfos/Tour"); List<TourXML> Tours = new List<TourXML>(); for (int index = 0; index < NodTours.Count; index++) { TourXML t = new TourXML(); XmlNode NameNode = NodTours[index].SelectSingleNode("Name"); t.Name = NameNode.InnerText; XmlNode CNNameNode = NodTours[index].SelectSingleNode("Name_CN"); t.CNName = CNNameNode.InnerText; XmlNodeList citysNodes = NodTours[index].SelectNodes("CityList/city"); for (int i = 0; i < citysNodes.Count; i++) { t.Citys.Add(citysNodes[i].Attributes["code"].Value); } XmlNode ImageNode = NodTours[index].SelectSingleNode("Image"); t.Image = ImageNode.InnerText; XmlNode TourAreaNode = NodTours[index].SelectSingleNode("TourArea"); t.TourArea = TourAreaNode.InnerText; Tours.Add(t); } return Tours; }
private List<TourXML> ReadXML() { XmlDocument m_XmlDoc = new XmlDocument(); m_XmlDoc.Load(Server.MapPath(".") + "\\TourExplainCityNameXML.xml"); XmlNodeList NodTours = m_XmlDoc.SelectNodes("TourInfos/Tour"); List<TourXML> Tours = new List<TourXML>(); for (int index = 0; index < NodTours.Count; index++) { TourXML t = new TourXML(); XmlNodeList citysNodes = NodTours[index].SelectNodes("CityList/city"); for (int i = 0; i < citysNodes.Count; i++) { t.Citys.Add(citysNodes[i].Attributes["code"].Value); } XmlNode ShowAreaNode = NodTours[index].SelectSingleNode("ShowArea"); t.ShowArea = ShowAreaNode.InnerText; Tours.Add(t); } return Tours; }