K i wont post again sorry can u help me to incremant
<div>
<h3>blah</h3>
<li>a</li>
<li>b</li>
</div>
<div>
<h3>blah2</h3>
<li>c</li>
<li>d</li>
</div>

(doc/"div").each do |dv|
 this_h3 = (dv/"h3")
 if this_h3.inner_html == "blah2"
   (dv/"li").each do |li|
     puts li.inner_html
   end
 end
end

  this is ur code  i wanted to check for all  inner_text <h3> tags ex:
"blah2" u given  how i can test for "blah1" all in loop

Regards
Prashanth

On Thu, Sep 10, 2009 at 1:32 PM, Colin Law <[email protected]> wrote:

>
> 2009/9/10 prashanth hiremath <[email protected]>:
> >
> > Thank u i have done what u told using gsub operator i replaces the tags
> to
> > the form as u told,but problem is that
> >
> > if
> >         doc = Hpricot(open('Delhi.txt'))
> >           x=doc.to_s
> >           doc1=x.gsub(/<(\/?)li><span>/,'</li></see><see><span>')
> >
> >           puts doc1
> >           doc1.search('span').each do |y|
> >           puts y.inner_text
> >          end
> >
> >
> > its giving error
> >
> >  undefined method `search' for #<String:0xb7d0bc74> (NoMethodError)
> > because doc1 is string how can i conevrt so that i can read the file
> again
> > by hpricot
>
> Please don't top post, it annoys readers on this list and makes it
> less likely that you will get help.
>
> I have not used hpricot but if I were in your situation the first
> thing I would do is carefully look through the documentation for
> hpricot.  Have you done that?
>
> Colin
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to