2010-03-16から1日間の記事一覧

hpricot:An Hpricot Showcase:Hpricot Challenge:Finding all text elements within a html document

まんま >> require "hpricot" => true >> doc = Hpricot('<p>foo 1</p> hoge <p>foo 2</p>') => #<Hpricot::Doc {elem <p> "foo 1" </p>} " hoge " {elem <p> "foo 2" </p>}> >> doc.search("*") => #<Hpricot::Elements[{elem <p> "foo 1" </p>}, "foo 1", " hoge ", {elem <p> "foo 2" </p>}, "foo 2"]> >> doc.search("*").…