public void Addqueue(Storage myStorage) { while (allXMLs.Count != 0) { string xml = allXMLs.Dequeue(); if (xml.Contains("http")) { using (var webclient = new WebClient()) { getXML = webclient.DownloadString(xml); } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(getXML); var results = xmlDoc.GetElementsByTagName("loc"); foreach (XmlElement result in results) { string links = result.InnerText; if (links.Contains("xml")) { allXMLs.Enqueue(links); } else { myStorage.AddQueue(links.Trim(), false); } } } } }
public void StartCrawling() { myStorage.AddQueue("getStart", true); myCrawler.readyCrawling(); myCrawler.StartCrawling(); }