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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:12:13+00:00 2026-05-15T22:12:13+00:00

I am using Xpath in Ruby with following statement. print XPath.first(Document.new(html),//tr[@id=’ctl00_c1_rr_ci_trAdd’]//td[2]) The Query return

  • 0

I am using Xpath in Ruby with following statement.

print XPath.first(Document.new(html),"//tr[@id='ctl00_c1_rr_ci_trAdd']//td[2]") 

The Query return the following text.

<td>

                1371 N Belsay Rd<br/>Burton, MI 48509
                <br/>
                <a href='http://www.mapquest.com/maps/map.adp?style=2&amp;address=1371+N+Belsay+Rd&amp;city=Burton&amp;state=MI&amp;zip=48509' class='rptLnk2' id='ctl00_c1_rr_ci_hlMapQuest' target='_blank'>See the location on a Mapquest Map</a>
                <br/>
                <a href='http://maps.google.com?q=1371+N+Belsay+Rd Burton, MI 48509' class='rptLnk2' id='ctl00_c1_rr_ci_hlGoogleMaps' target='_blank'>See the location on a Google Map</a>
            </td>

But I just want this text

1371 N Belsay Rd<br/>Burton, MI 48509

Can anyone tell me how to achieve this? When I am using scan statement – I am getting this error.

private method `scan' called for <td> ... </>:REXML::Element (NoMethodError)
  • 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-15T22:12:14+00:00Added an answer on May 15, 2026 at 10:12 pm

    An XPath expression to get this text 1371 N Belsay Rd — as a text node, is:

    ((//tr[@id='ctl00_c1_rr_ci_trAdd'])//td)[2]/text()[1]
    

    In case you want the expression to select the three nodes:

    1371 N Belsay Rd<br/>Burton, MI 48509
    

    you may use this one:

    normalize-space(((//tr[@id='ctl00_c1_rr_ci_trAdd'])//td)
                                  [2]
                                    /node()[not(position() > 3)])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse XML files using Nokogiri, Ruby and XPath. I usually
I'm new to using XPath so I've been fooling around with an XPath Evaluator
I want to parse HTML with lxml using XPath expressions. My problem is matching
I am loading HTML into DOM and then querying it using XPath in PHP.
How do I select the globally-last text node using xpath? I tried this, but
This Ruby code using Nokogiri doc.xpath(//tbody).remove removes the children of the <tbody> (as well
Using XPath to parse this link $html = '<a href=/browse/product.do?cid=1&amp;vid=1&amp;pid=1 class=productItemName>what is going on
I'm using XPATH to select certain nodes from an XML document. The user is
I'm using xpath's contains function to find elements that contain some text, like this:
What XPath query could I use to solve the below. I'm actually using nokogiri

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.