Rainer wrote: > What I need [...] is a method that > tells me the first HTML tag of a fragment, whatever it is. You may want to use Element#name: $ irb -r hpricot >> d = Hpricot('<div id="my_first_div">first div<p>a paragraph</p><span>a span</span></div>') => #<Hpricot::Doc {elem <div id="my_first_div"> "first div" {elem <p> "a paragraph</\np>" {elem <span> "a span" </span>}} </div>}> >> d.search('*').first.name => "div" Regards, ¥ÆËÎer [yet another Ruby beginner]. -- Posted via http://www.ruby-forum.com/.