Answer the question
In order to leave comments, you need to log in
What needs to be done in order for the program to work correctly with a "reference" indication of the path to the Html code?
Hello.
I'm trying to parse sites using HtmlAgilityPack.
For this I wrote the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.IO;
using HtmlAgilityPack;
namespace ConsoleParsingHTMLwithHtmlAgilityPack_CSarp
{
class Program
{
static void Main(string[] args)
{
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(@"<html><body><div><table id=""foo""><tr><th>hello</th></tr><tr><td>world</td></tr></table></div><div><table class='mfd-table'><tr><th>hello222</th></tr><tr><td>world222</td></tr></table></div></body></html>");
//doc.LoadHtml("mfd.ru/centrobank/correspondentaccountbalances/");
var docNode = doc.DocumentNode;
var x = docNode.SelectNodes("//table[@class='mfd-table']");
Console.WriteLine(x);
Console.ReadLine();
}
}
}
doc.LoadHtml(@"<html><body><div><table id=""foo""><tr><th>hello</th></tr><tr><td>world</td></tr></table></div><div><table class='mfd-table'><tr><th>hello222</th></tr><tr><td>world222</td></tr></table></div></body></html>");
doc.LoadHtml("mfd.ru/centrobank/correspondentaccountbalances/");
Answer the question
In order to leave comments, you need to log in
Apparently the problem is that you do not see the difference between the path to the html code and the http-get request.
stackoverflow.com/questions/18269983/c-sharp-htmla... - Here's a better example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question