Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Problems with scRUBYt

Reply
Thread Tools

Problems with scRUBYt

 
 
Cs Webgrl
Guest
Posts: n/a
 
      12-30-2008
Hi.

I am currently scraping a page with scRUBYt and am not getting the
results as expected.

Instead of the correctly formatted xml document I'm getting the
following.

<record>
<1>book a</1>
<1>book b</1>
<1>book c</1>
<2>chapter aa</2>
<2>chapter bb</2>
<2>chapter cc</2>
<3>verse aaa</3>
<3>verse bbb</3>
<3>verse ccc</3>
</record>

My code looks like this:

listing "//a[@id*='volume'>" do
book "//a[@class='1']"
chapter "//span[@class='2']"
verse "//a[@id*='3']"
end

Any ideas?

Sorry for the sample data, but hopefully someone has seen this before
and can help.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Aaron Patterson
Guest
Posts: n/a
 
      12-31-2008
On Wed, Dec 31, 2008 at 08:33:26AM +0900, Cs Webgrl wrote:
> Hi.
>
> I am currently scraping a page with scRUBYt and am not getting the
> results as expected.
>
> Instead of the correctly formatted xml document I'm getting the
> following.
>
> <record>
> <1>book a</1>
> <1>book b</1>
> <1>book c</1>
> <2>chapter aa</2>
> <2>chapter bb</2>
> <2>chapter cc</2>
> <3>verse aaa</3>
> <3>verse bbb</3>
> <3>verse ccc</3>
> </record>


This is a correctly formatted XML document. You just have numbers for
tag names.

> My code looks like this:
>
> listing "//a[@id*='volume'>" do
> book "//a[@class='1']"
> chapter "//span[@class='2']"
> verse "//a[@id*='3']"
> end
>
> Any ideas?


Have you tried something like this:

book "//2[@id='whatevs']"

That should get you access to the tags.

Hope that helps!

--
Aaron Patterson
http://tenderlovemaking.com/

 
Reply With Quote
 
 
 
 
Cs Webgrl
Guest
Posts: n/a
 
      12-31-2008
Aaron Patterson wrote:

>
> Have you tried something like this:
>
> book "//2[@id='whatevs']"
>
> That should get you access to the tags.



This gives me a ton of data, but now I have lost the specific pieces of
information that I'm looking for. Instead it looks like the output of
all of the sourced code on that page. Was I to change something else in
the code to get the specific piece of data that I need?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't install//use the scrubyt gem? LoadError: no such file to load-- parse_tree_reloaded. What did I wrong with installing this gem? kazaam Ruby 1 08-29-2007 02:42 PM
scRUBYt! 0.3.1 released Peter Szinek Ruby 0 05-29-2007 07:34 PM
[ANN] scRUBYt! 0.2.8 Peter Szinek Ruby 4 04-19-2007 10:50 PM
[ANN] scRUBYt! 0.2.3 - Hpricot and Mechanize on steroids Peter Szinek Ruby 2 02-21-2007 10:18 AM
[ANN] scrubyt.org - your source of scRUBYt! tutorials, howtos, newsand more Peter Szinek Ruby 0 02-05-2007 11:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57