class REXML::Elements

def each( xpath=nil )


...
...

Output:

elements.each('//book [@category="web"]') {|element| p element }

that matches the given +xpath+:
With argument +xpath+, calls the block with each element

...
...
...
...

Output:

elements.each {|element| p element }
elements = d.root.elements
d = REXML::Document.new(xml_string)

With no argument, calls the block with each element:

Iterates over the elements.

each(xpath = nil) {|element| ... } -> self
:call-seq:
def each( xpath=nil )
  XPath::each( @element, xpath ) {|e| yield e if e.kind_of? Element }
end