HTML Agility Pack - Get text from 1st STRONG tag inside SPAN tag

My SPAN tag has 5 STRONG tags from my Html document. I want to know how to get the text from the first STRONG tag inside TSAN TAN?

Here is my code.

        var web = new HtmlWeb();
        var doc = web.Load(url);

        var nodes = doc.DocumentNode.SelectNodes("//span[@class='advisory_link']/strong");

        foreach (var node in nodes)
        {
            richTextBox1.Text = node.InnerHtml;
        }

      

+3


source to share


1 answer


        var nodes = doc.DocumentNode.SelectNodes("//span[@class='advisory_link']//strong[1]");

        if (nodes != null)
        {
            foreach (var node in nodes)
            {
                string Description = node.InnerHtml;
                return Description;
            }
        }

        return null;

      



+1


source







All Articles