Can you let us know how you did it using Hpricot?

--
अभिनव
http://twitter.com/abhinav




On Thu, Sep 10, 2009 at 12:41 PM, prashanth hiremath
<[email protected]> wrote:
> Thax for reply i did using hpricot
>
>
> On Thu, Sep 10, 2009 at 12:33 PM, Abhinav Saxena <[email protected]>
> wrote:
>>
>> I don't know Hpricot, but what you can do is: first open the file and
>> do a gsub on the content, save it in a different/same file, and then
>> open it using Hpricot. Just to warn you, won't be very efficient if
>> files are huge or there are lot many files you want to process.
>>
>> I think, there must be some more simpler way of doing it as well.
>>
>> Thanks,
>> Abhinav
>> --
>> अभिनव
>> http://twitter.com/abhinav
>>
>>
>>
>>
>> On Thu, Sep 10, 2009 at 10:25 AM, prashanth hiremath
>> <[email protected]> wrote:
>> > Thank u i have done different method m using gsub operator i replaces
>> > the
>> > tags to the form ,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
>> >
>> > On Wed, Sep 9, 2009 at 6:42 PM, Frederick Cheung
>> > <[email protected]> wrote:
>> >>
>> >>
>> >>
>> >> On Sep 9, 12:50 pm, prashanth hiremath <[email protected]>
>> >> wrote:
>> >> > Hi
>> >> >
>> >> >  Please help me i want to replace the tag
>> >> >
>> >> > </li><span>    to   </li></see><see><span> at time
>> >> >
>> >> > can anybody in world give me an solution
>> >> >
>> >>
>> >> A little more context would be helpful.
>> >>
>> >> Fred
>> >> > Regards
>> >> >
>> >> > Prashant
>> >>
>> >
>> >
>> > >
>> >
>>
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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