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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:12:28+00:00 2026-05-28T08:12:28+00:00

Hi there I’ve just registered on this website, because I need some help. I

  • 0

Hi there I’ve just registered on this website, because I need some help.

I want to get results from the nyaa.eu website.

Basically:

  • Table Node is called <table class="tlist">
  • Every row node is called <tr class="tlistrow"> also sometimes it’s ‘trusted tlistrow’ etc.
  • The Nodes I try to retrieve are: <td class="tlistname"> <td class="tlistsize"> <td class="tlistsn"> and <td class="tlistln">

Firstly I’m retrieving a table which contains all the info about torrents:

HtmlNode hnTable = doc.DocumentNode.SelectSingleNode("//table[@class='tlist']");

So, next thing is retrieving all the rows which contains ‘tlistrow’ in its class attribute:

HtmlNodeCollection hncRows = hnTable.SelectNodes("//tr[contains(@class,'tlistrow')]");

And finally the problem is when I read every node it’s always the same one:

foreach (HtmlNode row in hncRows)
{
    foreach (HtmlNode child in row.ChildNodes)
    {
        if (child.SelectSingleNode("//td[@class='tlistname']") != null)
        {
            MessageBox.Show("Something found!\n\n" + child.SelectSingleNode("//td[@class='tlistname']").InnerText);
            break;
        }
    }
}

The text displayed in the messagebox is always the same, it looks like it only selects one node multiple times.

How can I fix this or if I am doing anything wrong, please correct me.

  • 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-28T08:12:29+00:00Added an answer on May 28, 2026 at 8:12 am
        foreach (HtmlNode child in row.ChildNodes)
        {
            if (child.SelectSingleNode("//td[@class='tlistname']") != null)
            {
                MessageBox.Show("Something found!\n\n" + child.SelectSingleNode("//td[@class='tlistname']").InnerText);
                break;
            }
        }
    

    You need to understand the difference between relative XPath expressions and absolute XPath expressions.

    A relative XPath expression is evaluated off (having as an initial context node) a specific node in the XML document.

    An absolute XPath expression is evaluated against the whole XML document (having as initial context node the document-node).

    Any XPath expression that starts with the character / is an absolute XPath expression.

    Based on the provided code, you want to use a relative XPath expression with an initial context node, containd in the variable named child.

    The problem is that the expression you are using:

    //td[@class='tlistname'] 
    

    starts with / and is therefore an absolute XPath expression.

    This, passed to the SelectSingleNode() method always selects the first td element in the whole XML document, that has a class attribute with string value "tlistname."

    Solution: Use a relative XPath expression, such as:

    .//td[@class='tlistname'] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
There was some code like this: // Convenience to make things more legible in
There is previous little on the google on this subject other than people asking
There are a few ways to get class-like behavior in javascript, the most common
I have just tried to save a simple *.rtf file with some websites and
There is a website called Gild.com that has different coding puzzles/challenges for users to
There is this strange situation I'm fighting on. I have 3 pages, les call
There are a lot of Jquery plugins and libraries. and sometimes I want to
There are many tutorials that talk about deleting index.php from the url. But I
There must be a simple solution to this, but after 4 hours of browsing

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.