each_element_with_text( text=nil, max=0, name=nil )
Instance Public methods
Iterates through the children, yielding for each Element that has a particular text set.
- text
-
the text to search for. If nil, or not supplied, will iterate over all
Element
children that contain at least oneText
node. - max
-
(optional) causes this method to return after yielding for this number of matching children
- name
-
(optional) if supplied, this is an XPath that filters the children to check.
1 2 3 4 5 6 7 8 9 | doc = Document. new '<a><b>b</b><c>b</c><d>d</d><e/></a>' # Yields b, c, d doc.each_element_with_text {|e|p e} # Yields b, c doc.each_element_with_text( 'b' ){|e|p e} # Yields b doc.each_element_with_text( 'b' , 1 ){|e|p e} # Yields d doc.each_element_with_text( nil , 0 , 'd' ){|e|p e} |
Please login to continue.