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

  • Home
  • SEARCH
  • 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 3489980
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:27:39+00:00 2026-05-18T11:27:39+00:00

I am trying to extract some data from a website using a LINQ statement,

  • 0

I am trying to extract some data from a website using a LINQ statement, the XML is in the following form.

<parent> 
  <p>
    <b>
      Title
    </b>
  </p>
  <p>
    blurb
  </p>
  <p>
    <b>
      As Of Date
    </b>
  </p>
  <center>
    <table>
      <tr>
        <th>
          Header
        </th>
      </tr>
      <tr>
        <td>
          Data
        </td>
      </tr>
    </table>
  </center>
  <p>
    <b>
      As Of Date
    </b>
  </p>
  <center>
    <table>
      <tr>
        <th>
          Header
        </th>
      </tr>
      <tr>
        <td>
          Data
        </td>
      </tr>
    </table>
  </center>
</p>

I would like to get the As Of Date and Data (the data row is iterated several times). Also the table and as of date appear several times in the document (the table is active from a date).

I can get the rows using the following LINQ but how do I get the As Of Date

Dim l_PricesTable = From rows In l_Xml.Descendants("tr") _
                   Where ((rows.Descendants("td") IsNot Nothing) AndAlso (rows.Descendants("td").Count >= 1)) _
                          Select Data = rows.Descendants("td")(0).Value,
                          AsOfDate = ???

I have no way of changing the XML as it is a 3rd party source. There is no XML element which contains just the as of date and also the table, they are all under the one parent node.

I am confident in C# and VB.Net so any solution is OK.

Any help would be appreciated.

Thanks

Dave

  • 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-18T11:27:39+00:00Added an answer on May 18, 2026 at 11:27 am

    I have got round this problem in a really messy way, but as no other answers are forthcoming I will post what I have done.

    Dim l_PricesTable = From rows In l_Xml.Descendants("tr") _ 
                   Where ((rows.Descendants("td") IsNot Nothing) AndAlso (rows.Descendants("td").Count >= 1)) _ 
                          Select Data = rows.Descendants("td")(0).Value, 
                          AsOfDate = rows.Parent.Parent.ElementsBeforeSelf("p")(rows.Parent.Parent.ElementsBeforeSelf("p").Count - 1).Descendants("b").Value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to extract some data from various HTML pages using a python program.
I've got a xml that I'm parsing and trying to extract some data from.
I am trying to extract some data from XML but when I execute the
I'm trying to write a code to extract some form data from a HTML
I'm trying to extract data from a data file that's tab-delimited (in some parts),
Hey guys. I'm trying to parse xml file in order to extract some data
I am trying to extract some data from a private forum. I created a
I am trying to extract some meta data from Oracle about foreign keys. I
I am trying to automate data extraction from a website and I really don't
I am trying to extract blocks of JSON data from a data stream in

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.