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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:22:42+00:00 2026-05-25T02:22:42+00:00

I would like to parse an HTML table and disaply contents using XML to

  • 0

I would like to parse an HTML table and disaply contents using XML to LINQ in an bound listbox.

I am using HTML Agility pack and using this code.

    HtmlWeb web = new HtmlWeb();
    HtmlAgilityPack.HtmlDocument doc = web.Load("http://www.SourceURL");
    HtmlNode rateNode = doc.DocumentNode.SelectSingleNode("//div[@id='FlightInfo_FlightInfoUpdatePanel']");
    string rate = rateNode.InnerText;
    this.richTextBox1.Text = rate;

The HTML looks like this..

<div id="FlightInfo_FlightInfoUpdatePanel">

   <table cellspacing="0" cellpadding="0"><tbody>
     <tr class="">
     <td class="airline"><img src="/images/airline logos/NZ.gif" title="AIR NEW ZEALAND LIMITED. " alt="AIR NEW ZEALAND LIMITED. " /></td>
     <td class="flight">NZ8</td>
     <td class="codeshare">&nbsp;</td>
     <td class="origin">San Francisco</td>
     <td class="date">01 Sep</td>
     <td class="time">17:15</td>
     <td class="est">18:00</td>
     <td class="status">DEPARTED</td>
     </tr>

But it is returning this

NZ8&nbsp;San Francisco01 Sep17:1518:00DEPARTEDAC6103NZ8San Francisco01 Sep17:1518:00DEPARTEDCO6754NZ8San Francisco01 Sep17:1518:00DEPARTEDLH7157NZ8San Francisco01 Sep17:1518:00DEPARTEDUA6754NZ8San Francisco01 Sep17:1518:00DEPARTEDUS5308NZ8San Francisco01 Sep17:1518:00DEPARTEDVS7408NZ8San Francisco01 Sep17:1518:00DEPARTEDEK407&nbsp;Melbourne/Dubai01 Sep17:5017:50DEPARTEDEK413&nbsp;Sydney/Dubai01 Sep18:0018:00DEPARTEDQF44&nbsp;Sydney01 

What I would like is pasrse this to XML format and then use LINQ to XML to parse the XML to a bound listbox itemsource.

I am thinking I need to use a variation of the below for each class, but would like some help.

HtmlNodeCollection cols = rows[i].SelectNodes(".//td[@class='flight']");
  • 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-25T02:22:42+00:00Added an answer on May 25, 2026 at 2:22 am

    You are using InnerText which strips out the HTML.

    Use InnerHtml:

    string rate = rateNode.InnerHtml;
    

    You can create an XML document from this string (assuming it is valid XML).

    You can also query the rateNode in the same way you retrieved it – selecting its child nodes:

    var firstRow = rateNode.SelectSingleNode("./table/tbody/tr[0]");
    string origin = firstRow.SelectSingleNode("./td[@class = 'origin']");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to parse a table using Nokogiri. I'm doing it this way
I would like to know if there is a simple way to parse HTML
I would like to parse a document using SAX, and create a subdocument from
I would like to parse out any HTML data that is returned wrapped in
I'm using and $.ajax method to get an html text. I would like to
I have been trying to use the HTML Agility Pack to parse HTML into
I would like to parse a html page and extract the meaningful text from
I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection .
I would like to know the procedure to adopt to parse and obtain text
Would like to get a list of advantages and disadvantages of using Stored Procedures.

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.