public class CarService : System.Web.Services.WebService { private static XmlDocument doc = null; public XmlDocument Doc { get { if (doc == null) // Read XML data from disk { doc = new XmlDocument(); doc.Load(HttpContext.Current.Server.MapPath("~/App_Data/Cars.xml")); } return doc; } } private List getNames(string path) { List nameList = new List(); try { XmlNodeList nodeList = Doc.SelectNodes(path); foreach (XmlNode node in nodeList) nameList.Add(node.Attributes["name"].InnerText); } catch (Exception ex) { nameList.Add(ex.Message); } return nameList; } /* [WebMethod] public List GetMakes() { } [WebMethod] public List GetModels(string make) { } */ [WebMethod] public List GetColors(string make, string model) { string path = String.Format("/cars/make[@name='{0}']/model[@name='{1}']/colors/color", make, model); return getNames(path); } }