Converting a HtmlAgilityPack.HtmlNode to a string

c# html html-agility-pack string

Question

private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("In devolopment","Error", MessageBoxButtons.OK);
            HtmlAgilityPack.HtmlWeb hw = new HtmlAgilityPack.HtmlWeb();
            HtmlAgilityPack.HtmlDocument doc = hw.Load("https://www.stackoverflow.com");
            foreach (HtmlAgilityPack.HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
            {
                usercon(link);
            }

        }

.

public void usercon(string toprint)
        {
            richTextBox1.Text += "\r\n";
            richTextBox1.Text += toprint;
            //richTextBox1.
        }

I must be capable of converting.link so that it may be utilized in the method, to a stringusercon

I'm utilizing the for the first time,HtmlAgilityPack .

1
0
3/10/2017 4:04:15 AM

Accepted Answer

According to this page's source code: https://htmlagilitypack.codeplex.com/SourceControl/latest#Release/1_4_0/HtmlAgilityPack/HtmlNode.cs
Check out the (new) documentation at http://html-agility-pack.net/outer-html. The source of HtmlNode's OuterHtml attribute is GitHub.

private void button2_Click(object sender, EventArgs e)
{
    MessageBox.Show("In devolopment","Error", MessageBoxButtons.OK);
    HtmlAgilityPack.HtmlWeb hw = new HtmlAgilityPack.HtmlWeb();
    HtmlAgilityPack.HtmlDocument doc = hw.Load("https://www.stackoverflow.com");
    foreach (HtmlAgilityPack.HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
    {
        usercon(link.OuterHtml);
    }
}
1
12/12/2017 11:00:10 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow