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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:46:15+00:00 2026-05-24T01:46:15+00:00

I could not find the exact question answered on this site. The html on

  • 0

I could not find the exact question answered on this site.
The html on the page has many elements, some of them contain header cells “tr”, some actual data cells “td”

Here is an example:

<tr align="center">
    <th width="63"><b>&nbsp;</b></th>
    <th width="293"><b>Partners</b></th>
    <th width="54"><b>Score</b></th>
    <th width="184"><b>Type of Partner</b></th>
</tr>            
<tr>
 <td>&nbsp;</td>
 <td height="17">Acme trucking</td>
 <td align="center">0.75</td>
 <td>Truck Carrier</td>
</tr>

I need to find all “tr” elements that contain only “td” elements, in other words, exclude all that contain “th” elements

I would also like to have even more specific xpath expression that will find only “tr” elements that contain exactly 4 “td” child elements.

If you can provide 2 separate xpath expressions for just trs that have only “td”
and another one for “tr” that have exactlly 4 “td” I would really appreciate it.

  • 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-24T01:46:15+00:00Added an answer on May 24, 2026 at 1:46 am
    1. //tr[td and count(td) = count(*)] or //tr[td and not(*[not(self::td)])]
    2. //tr[count(td) = 4 and count(td) = count(*)]

    If you need tr with td only and without text, e.g.:

    <root>
        <tr>
            Text here
            <td></td>
        </tr>
    </root>
    

    Suppose, it is not valid tr, you can use:

    //tr[td and count(td) = count(*) and not(normalize-space(text()))]
    

    It allows only whitespaces.

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

Sidebar

Related Questions

This is a basic question and yet I could not find an exact duplicate
I could not find the answer to this exact question but there are related
I could not find a clear answer to this question elsewhere, so I'll try
First, I know this is kind of common question, but I could not find
I have searched but could not find the reason for this behavior. I have
I've been searching around but could not find any answers to this. What I'm
I have been looking everywhere but could not find a tutorial for this. I
I have some urgent issue which I could not find answer for across the
I apologize if this question has been answered elsewhere, but I couldn't seem to
i have searched a lot but could not find the exact way to do

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.