2010-01-30から1日間の記事一覧

hpricot:An Hpricot Showcase:Hpricot Basics:Fetching the HTML for an Element

>> require "hpricot" => true >> doc = Hpricot("<p>A simple <b>test</b> string.</p><p>foo</p>") => #<Hpricot::Doc {elem <p> "A simple " {elem <b> "test" </b>} " string." </p>} {elem <p> "foo" </p>}> >> doc.search("p").to_html => "<p>A simple <b>test</b> string.</p><p>foo</p>" >> doc.search("p")[0].to…