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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:59:13+00:00 2026-05-16T01:59:13+00:00

I have about 5000 html files in a folder. I need to loop through

  • 0

I have about 5000 html files in a folder. I need to loop through them, open, grab say 10 values using xpath, close, and store in (SQL Server) DB.

What is the easiest way to do read the xpath values using .Net?

The xpaths should be pretty stable.

Please provide example code to read one value, say /html/head/title/text()

Thanks

  • 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-16T01:59:14+00:00Added an answer on May 16, 2026 at 1:59 am

    I think you should look into the HTML Agility Pack. It is an HTML parser rather than an XML parser, and is better for this task. If there is anything that doesn’t agree with the XML being parsed then the parser will throw and exception. Using an HTML parser gives you a bit more leeway with the input files.

    Example showing how to do something with all HREF (link) attributes:

     HtmlDocument doc = new HtmlDocument();
     doc.Load("file.htm");
     foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"])
     {
        HtmlAttribute att = link["href"];
        att.Value = FixLink(att);
     }
    

    I’m not near a compiler but the example you want is something like:

    string title = doc.DocumentNode.SelectSingleNode("//title").InnerText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a product using Oracle, with about 5000 objects in the database (tables
I have about 5000 markers I need to render on Google Map. I'm currently
I have contours (about 5000 polylines) in shapefile and I need to interpolate those
I have about 5000 records in a table in SQL Server 2008 I need
I have a large 100mb file which I would like to perform about 5000
I have about 20 grid views that I have to create. All of them
This is the scenario: I have a list of about 5000 URLs which have
I have the following HTML: <ul> <li id=about><a href=#about class=goto_about>About us<span>who we are</span></a></li> <li
Basically I have this application which scans through all mp3's in a folder and
I have a large amount of data about 5000 to 6000 records. I bind

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.