Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:45:28+00:00 2026-06-09T04:45:28+00:00

HTML: <strong>Capture Date/Time:</strong> August 1, 2012 1:05:00 PM EST<br> <strong>Instructor:</strong> Ash<br> <strong>Instructor Email:</strong> email@email.com<br>

  • 0

HTML:

<strong>Capture Date/Time:</strong> August 1, 2012 1:05:00 PM EST<br>
<strong>Instructor:</strong> Ash<br>
<strong>Instructor Email:</strong> email@email.com<br>
<strong>Course ID:</strong> Course321<br>

How would I go about getting the text on the right of each strong node?

For example, to get the course ID so I ended up with a string of “Course321”.

Code:

private string getCourseID()
{
    foreach (HtmlAgilityPack.HtmlNode strong in htmlDoc.DocumentNode.SelectNodes("//strong"))
    {
        string innerText = strong.InnerText;

        if (innerText.Contains("Course ID"))
        {
            //select the outer text
            //return outertext;
        }
    }
}

Current Code:

private string getCourseID()
{
    HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();

    string value = "Error";

    foreach (HtmlAgilityPack.HtmlNode strong in htmlDoc.DocumentNode.SelectNodes("//strong"))
    {
        string innerText = strong.InnerText;

        if (innerText.Contains("Course ID"))
        {
            HtmlAgilityPack.HtmlNode sibling = strong.SelectSingleNode("following-sibling::text()");

            value = sibling.InnerText.Trim();

            MessageBox.Show(value);
        }
    }

    return value;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:45:30+00:00Added an answer on June 9, 2026 at 4:45 am

    Using the following-sibling::* XPath axis:

    HtmlNode sibling = strong.SelectSingleNode("following-sibling::text()");
    Console.WriteLine("Course ID = " + sibling.InnerText.Trim());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a regular expression, say /url.com\/([A-Za-z]+)\.html/ , and I would like to replace
I'm not very strong in HTML, and each time I have some encoding problems.
I'm writing a logging function for automation unit test. html elements structure: <li> <strong>
I have the following: string html_string = http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=pharma; string html; html = new WebClient().DownloadString(html_string);
Given the following URIs sample: /index.site.rooms.98.html /index.site.rates.665678.html I need to capture the string which
I want to capture the text within the square brackets in the html string
I'm using preg_match to try and capture the 'Data' in this html structure but
I am having some trouble trying to capture the rendered html of an elmenet
I am new to MVC2.0. I use the below code to capture HTML and
I would like to parse an HTML form and pull our filename's of any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.