On 9/2/06, jonbjo <jonbjo-ee4meeAH724@public.gmane.org>
wrote:> I am making a campaign site for a client. On the site he want me to
> reuse parts of exsisting webpages from his corporate site.
> What I want to do is to extract a certain part from exsisting web page
> and then inject that into my own template and serv it.
> The content that I need to extract is inside a a named div, i.e.
> everything inside
> <div id=maincontentBox"> and the closing </div>.
>
> Can anyone give me some pointers in the right direction?
# gem install hpricot --source code.whytheluckystiff.net
require ''rubygems''
require ''hpricot''
doc = Hpricot.parse(File.read("index.html"))
doc.at("div#maincontentBox").inner_html
More information and examples are at: http://code.whytheluckystiff.net/hpricot/
> /Jonas
Sincerely,
Tom Lieber
http://AllTom.com/
http://GadgetLife.org/
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---