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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:57:57+00:00 2026-05-29T22:57:57+00:00

i am trying to traverse an html document: <body class=style_0> <div> <div class=style_1>Pending Test

  • 0

i am trying to traverse an html document:

<body class="style_0">
        <div>
            <div class="style_1">Pending Test List</div>
            <table style=" width: 100%;" id="AUTOGENBOOKMARK_4365445353431356880">
                <col>
                <col>
                <tbody>
                    <tr>
                        <td style="vertical-align: baseline;">
                            <div class="style_4">Pending Test List</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_5">SOME AGENCY Laboratories, Inc.</div>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table class="style_6" style=" width: 4.531in;" id="AUTOGENBOOKMARK_5083738604442918131">
                <col style=" width: 1in;">
                <col class="style_7" style=" width: 0.75in;">
                <col class="style_8" style=" width: 0.6in;">
                <col style=" width: 0.75in;">
                <col style=" width: 2.375in;">
                <tbody>
                    <tr class="style_9" style=" height: 0.5in;">
                        <td style="vertical-align: middle;">
                            <div class="style_10">Report Range:</div>
                        </td>
                        <td style="vertical-align: middle;">
                            <div class="style_11">01/01/2012</div>
                        </td>
                        <td style="vertical-align: middle;">
                            <div class="style_12">through</div>
                        </td>
                        <td style="vertical-align: middle;">
                            <div class="style_13">01/31/2012</div>
                        </td>
                        <td style="vertical-align: middle;">
                            <div class="style_14">(by Date Entered)</div>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table class="style_15" style=" width: 100%;" id="AUTOGENBOOKMARK_7602283385844673591" iid="/526

(QuRs78576248:0)">
                <col style=" width: 0.75in;">
                <col style=" width: 1.25in;">
                <col style=" width: 1in;">
                <col style=" width: 1.5in;">
                <col style=" width: 1.5in;">
                <col style=" width: 1.5in;">
                <col>
                <thead>
                    <tr>
                        <td colspan="4" style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                    </tr>
                    <tr>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Entered</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Spec. ID</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Batch/Pos.</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Test</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Client ID</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Client Name</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_16">Agency</div>
                        </td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">1/30/12</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_19">ZZ324sdf</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">51446 / 75</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">HOLD_DE</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">234234</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">smith, john</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">PPPM-6P - SOME AGENCY</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">1/31/12</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_19">SFD3434</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">51668 / 17</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">HOLD_DE</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">FOY, EL</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">FOY, ALEX</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">someagency &amp; Associates LLC</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">1/31/12</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_19">SFD3434</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">51668 / 25</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">HOLD_DE</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">JAMISON, PA</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">JAMISON, ROY</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">someagency &amp; Associates LLC</div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">1/31/12</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_19">SFD3434</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_18">51669 / 34</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">HOLD_DE</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">NEWMAN, SO</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">NEWMAN, ALEX</div>
                        </td>
                        <td class="style_17" style="vertical-align: baseline;">
                            <div class="style_20">someagency &amp; Associates LLC</div>
                        </td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="2" style="vertical-align: baseline;">
                            <div class="style_21">Total Tests:</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_22">4</div>
                        </td>
                        <td style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                        <td style="vertical-align: baseline;"></td>
                    </tr>
                </tfoot>
            </table>
            <table style=" width: 100%;" id="AUTOGENBOOKMARK_8507236727661888074">
                <col>
                <col>
                <col>
                <tbody>
                    <tr>
                        <td style="vertical-align: baseline;">
                            <div class="style_2">
                                <br>Feb 13, 2012 9:37 AM</div>
                        </td>
                        <td style="vertical-align: baseline;">
                            <div class="style_3">
                                <br>
                                <div style="text-align:center;">Page 1</div>
                            </div>
                        </td>
                        <td style="vertical-align: baseline;"></td>
                    </tr>
                </tbody>
            </table>
        </div>
    </body>

for this data:

enter image description here

so far i have this:

foreach (var row in htmlSnippet.DocumentNode.SelectNodes("//table[@class = 'style_15']/tbody/tr"))
                {
                    foreach (var cell in row.SelectNodes("div[@class='*']"))
                    {
                        textBox1.Text = cell.InnerHtml.ToString();
                    }
                }

however i am not returning anything!

this line is working:

//table[@class = 'style_15']/tbody/tr

but this does not return anthing:

("div[@class='*']"))

please let me know what i am doing wrong! i need help returning every piece of data as shown in the image (except for the field names)

  • 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-29T22:57:58+00:00Added an answer on May 29, 2026 at 10:57 pm

    You probably want simply div[@class]—a div element that has a class attribute.

    Oh, it’s also worth noting that the HTML/XML sample you provided is not well-formed. I had to remove all the col elements, and close the br elements. Maybe, for C#, that’s an issue… I know it is for XSL in general… not sure about XPath.

    I don’t have time to code up a C# example, but here’s a simple XSL:

    <xsl:template match="/">
      <so>
        <xsl:apply-templates select="//table[@class = 'style_15']/tbody/tr"/>
      </so>
    </xsl:template>
    <xsl:template match="div[@class]">
      <xsl:copy-of select="."/>
    </xsl:template>
    

    I get this output:

    <so>
      <div class="style_18">1/30/12</div>
      <div class="style_19">ZZ324sdf</div>
      <div class="style_18">51446 / 75</div>
      <div class="style_20">HOLD_DE</div>
      <div class="style_20">234234</div>
      <div class="style_20">smith, john</div>
      <div class="style_20">PPPM-6P - SOME AGENCY</div>
      <div class="style_18">1/31/12</div>
      <div class="style_19">SFD3434</div>
      <div class="style_18">51668 / 17</div>
      <div class="style_20">HOLD_DE</div>
      <div class="style_20">FOY, EL</div>
      <div class="style_20">FOY, ALEX</div>
      <div class="style_20">someagency &amp; Associates LLC</div>
      <div class="style_18">1/31/12</div>
      <div class="style_19">SFD3434</div>
      <div class="style_18">51668 / 25</div>
      <div class="style_20">HOLD_DE</div>
      <div class="style_20">JAMISON, PA</div>
      <div class="style_20">JAMISON, ROY</div>
      <div class="style_20">someagency &amp; Associates LLC</div>
      <div class="style_18">1/31/12</div>
      <div class="style_19">SFD3434</div>
      <div class="style_18">51669 / 34</div>
      <div class="style_20">HOLD_DE</div>
      <div class="style_20">NEWMAN, SO</div>
      <div class="style_20">NEWMAN, ALEX</div>
      <div class="style_20">someagency &amp; Associates LLC</div>
    </so>
    

    This is just an intermediate output to show that the XPath is working correctly.

    Hope this helps.

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

Sidebar

Related Questions

i am trying to traverse a given directory and create a list of files
I traverse an html document with SGML and XmlDocument. When I find an XmlNode
I have an XML document I'm trying to traverse, which is SDMX-compliant. Here's a
I'm having a real case of the monday's. I'm trying to traverse a table
I'm trying to access XML content attached to the end of a HTML document
I'm trying to traverse an XML document and select certain node attributes. The XML
Basically what I'm trying to do is traverse a pretty big (>2k lines) table,
I'm trying to traverse a simple XML document with Java, but for some reason
I'm trying to traverse through all the subdirectories of the current directory in Perl,
I've been trying to think of a way to traverse a hierarchical structure, like

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.