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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:39:00+00:00 2026-06-07T13:39:00+00:00

I am brand new to Ruby and Xpath. I need to extract the System

  • 0

I am brand new to Ruby and Xpath. I need to extract the System features from the table at

http://h10010.www1.hp.com/wwpc/ie/en/ho/WF06b/321957-321957-3329742-89318-89318-5186820-5231694.html?dnr=1

So far I have tried targeting all of the td tags, the page doesn’t use CSS ids so I cant target that way.

I tried the following code

doc.xpath('//tr/th/span[normalize-space(text())="System features"]/..')

but it returns nothing ;(

Does anyone have any idea the best way to approach this?

  • 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-06-07T13:39:05+00:00Added an answer on June 7, 2026 at 1:39 pm

    That expression should work fine on the given source, but it’s not really idiomatic. You probably want to use something more like this:

    //tr/th[span[normalize-space()='System features']
    
    1. normalize-space expects a string argument. Passing the node-set returned by text() forces conversion to a string by taking the first text node in document order. This doesn’t really matter in your document, because there’s only one child text node, but you should be aware that this is what’s happening.
    2. You don’t need to backtrack up the tree using /.. at the end of the expression. You can test for the presence of the child span using a nested predicate and thereby select the desired th directly.

    If you want to exploit the fact that the target th contains only the one child span node, you could write this simplified expression:

    //tr/th[normalize-space(span)='System features']
    

    So, why isn’t working? Hard to tell, but it could be because the tool you’re using to parse the document is creating a structure that differs from how it appears in the literal source (e.g. because the input isn’t really well-formed XML). Try a slightly different expression:

    //*[span[@class='themebody' and normalize-space()='System features']]
    

    Or maybe you should first verify that you can retrieve the span itself, then build the expression up from that:

    //span[@class='themebody' and normalize-space()='System features']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to java, coming from a ruby world. One thing I love
Brand new to Ruby. Am trying to sort a de-duplicated list of email FROM
I'm brand new to ruby and rails and I'm having trouble creating a sign-out
I'm brand new at Ruby. Trying to set up the first application/project using Aptana
Am brand new to Ruby looking to get Redmine to run on WinServer08 sp1
I'm brand new to ruby. I've written a little script, and at the top
I'm brand new to ruby and Watir, here's my issue... I have a MySQL
I am brand new to ruby, and am starting to build a little shopping
I'm brand new to Ruby/Rails/RSpec, and hopefully this is a dumb/simple question. I'm currently
I'm brand new to Ruby and Rails. I've been asked to help modify a

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.