Esempio n. 1
0
        public void play()
        {
            LenientHtmlDocument doc = new LenientHtmlDocument();

            foreach (string url in new string[] {
                "http://www.cnn.com/",
                "http://www.google.com/",
                "http://www.bankofamerica.com/",
                "http://www.citicard.com/"
            })
            {
                try
                {
                    Scraper scraper = new Scraper();
                    ScrapedPage page = scraper.Scrape(ScrapeType.GET, url);
                    doc.LoadXml(page.RawStream);
                    Console.WriteLine(doc.InnerXml);
                }
                catch (System.Net.WebException)
                {
                }
            }
        }
Esempio n. 2
0
 private static void DoCompare(Dictionary<string, string> cmp, LenientHtmlDocument doc)
 {
     foreach (string x in cmp.Keys)
     {
         Console.WriteLine(GlobalConstants.DividerEquals);
         Console.WriteLine("Loading:");
         Console.WriteLine(x);
         string y = cmp[x];
         doc.LoadXml(x);
         Console.WriteLine(GlobalConstants.DividerEquals);
         string output = doc.DocumentElement.OuterXml;
         Console.WriteLine(output);
         Assert.AreEqual(y, output);
         output = doc.OuterHtml;
         Console.WriteLine(output);
     }
 }
Esempio n. 3
0
 private void Test(string convert, string compare)
 {
     LenientHtmlDocument doc = new LenientHtmlDocument();
     doc.CreateDefaultDocumentElement = true;
     doc.LoadXml(convert);
     Console.WriteLine(doc.DocumentElement.InnerXml);
 }