module Hpricot::Doc::Trav
Public Instance Methods
css_path()
click to toggle source
# File lib/hpricot/traverse.rb, line 641 def css_path nil end
root()
click to toggle source
# File lib/hpricot/traverse.rb, line 805 def root es = [] children.each {|c| es << c if c.elem? } if children raise Hpricot::Error, "no element" if es.empty? raise Hpricot::Error, "multiple top elements" if 1 < es.length es[0] end
title()
click to toggle source
title
searches title and return it as a text. It returns nil
if not found.
title
searchs following information.
-
<title>…</title> in HTML
-
<title>…</title> in RSS
# File lib/hpricot/traverse.rb, line 744 def title e = find_element('title', '{http://www.w3.org/1999/xhtml}title', '{http://purl.org/rss/1.0/}title', '{http://my.netscape.com/rdf/simple/0.9/}title') e && e.extract_text end
traverse_all_element(&block)
click to toggle source
# File lib/hpricot/traverse.rb, line 635 def traverse_all_element(&block) children.each {|c| c.traverse_all_element(&block) } if children end
traverse_some_element(name_set, &block)
click to toggle source
# File lib/hpricot/traverse.rb, line 660 def traverse_some_element(name_set, &block) children.each {|c| c.traverse_some_element(name_set, &block) } if children end
xpath()
click to toggle source
# File lib/hpricot/traverse.rb, line 638 def xpath "/" end