Exemplo n.º 1
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void StartCrawling()
 {
     myStorage.AddQueue("getStart", true);
     myCrawler.readyCrawling();
     myCrawler.StartCrawling();
 }