Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: having an error

$
0
0

I tried to use it like this

  if (doc.DocumentNode.SelectNodes(@"//a[@href]" != null)) //I've put the code you've written here
                    {
                    // And and now queue up all the links on this page
                    foreach (HtmlNode link in doc.DocumentNode.SelectNodes(@"//a[@href]"))
                    {
                        HtmlAttribute att = link.Attributes["href"];
                        if (att == null) continue;
                        string href = att.Value;
                        if (href.StartsWith("javascript", StringComparison.InvariantCultureIgnoreCase)) continue;      // ignore javascript on buttons using a tags

                        Uri urlNext = new Uri(href, UriKind.RelativeOrAbsolute);

                        // Make it absolute if it's relative
                        if (!urlNext.IsAbsoluteUri)
                        {
                            urlNext = new Uri(urlRoot, urlNext);
                        }

                        if (!allSiteUrls.Contains(urlNext))
                        {
                            allSiteUrls.Add(urlNext);               // keep track of every page we've handed off

                            if (urlRoot.IsBaseOf(urlNext))
                            {
                                queue.Enqueue(urlNext);
                            }
                            else
                            {
                                yield return new WebPage.External() { Url = urlNext };
                            }

but is not working

I have these errors

Error 1 The best overloaded method match for 'HtmlAgilityPack.HtmlNode.SelectNodes(string)' has some invalid arguments D:\situri\baze de date\htmlAgility\htmlAgility\test.cs 66 25 htmlAgility

Error 2 Argument 1: cannot convert from 'bool' to 'string' D:\situri\baze de date\htmlAgility\htmlAgility\test.cs 66 54 htmlAgility


Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>