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 4091248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:20:33+00:00 2026-05-20T19:20:33+00:00

This seems like it should be a easy thing to do but I am

  • 0

This seems like it should be a easy thing to do but I am having some major issues with this. I am trying to parse for a specific tag with the HAP. I use Firebug to find the XPath I want and come up with //*[@id=”atfResults”]. I believe my issue is with the ” since the signals the start and end of a new string. I have tried making it a literal string but I have errors. I have attached the functions

        public List<string> GetHtmlPage(string strURL)
    {
        // the html retrieved from the page

        WebResponse objResponse;
        WebRequest objRequest = System.Net.HttpWebRequest.Create(strURL);
        objResponse = objRequest.GetResponse();
        // the using keyword will automatically dispose the object 
        // once complete
        using (StreamReader sr =
        new StreamReader(objResponse.GetResponseStream()))
        {//*[@id="atfResults"]
            string strContent = sr.ReadToEnd();
            // Close and clean up the StreamReader
            sr.Close();
            /*Regex regex = new Regex("<body>((.|\n)*?)</body>", RegexOptions.IgnoreCase);

            //Here we apply our regular expression to our string using the 
            //Match object. 
            Match oM = regex.Match(strContent);
            Result = oM.Value;*/

            HtmlDocument doc = new HtmlDocument();
            doc.Load(new StringReader(strContent));
            HtmlNode root = doc.DocumentNode;
            List<string> itemTags = new List<string>();



            string listingtag = "//*[@id="atfResults"]";

            foreach (HtmlNode link in root.SelectNodes(listingtag))
            {
                string att = link.OuterHtml;

                itemTags.Add(att);
            }

            return itemTags;
        }

    }
  • 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-05-20T19:20:34+00:00Added an answer on May 20, 2026 at 7:20 pm

    You can escape it:

    string listingtag = "//*[@id=\"atfResults\"]";
    

    If you wanted to use a raw string, it would be:

    string listingtag = @"//*[@id=""atfResults""]";
    

    As you can see, raw strings don’t really provide a benefit here.

    However, you can instead use:

    HtmlNode link = doc.GetElementById("atfResults");
    

    This will also be slightly faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it should be something that's easy to do, but I can't
It seems like this should be straightforward but I'm boggling. I've got my listview
First check out this code. I seems like it should work for me, but
This seems like it should be easy yet I must be missing something. I
It seems like there should be something shorter than this: private string LoadFromFile(string path)
Anybody have a slicker way to do this? Seems like it should be easier
This seems like a pretty softball question, but I always have a hard time
This seems like a simple question, but I can't find it with the Stack
This seems like a silly question but I would really like your comments and
This seems like such a trivial problem, but I can't seem to pin how

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.