In article <1125257760.436346.52640 / f14g2000cwb.googlegroups.com>,
	"zerohalo" <zerohalo / gmail.com> writes:
> Michael, I came across the same problem recently when using ruby/rexml
> for the first time.
> 
> The reason why you're not getting results is because each_element and
> each_element_with_attribute commands only iterate through the element's
> immediate children. They don't recurse through all the descendants. So
> what you're probably getting is just the root element and none of the
> children.
> 
> If you need to iterate through all the elements in the whole document,
> then use the XPath.each command. For example XPath.each('/////methods')
> { |x|  whatever you want to do with them } should work. That's what I
> finally had to do in my recent experience. I'm not sure what XPath
> search you would use to go through ALL of the elements in the document,
> but with some experimentaiton you'll probably find it. (And post what
> you find!)
> 
> There may be a better way to do this and I posted something about this
> a couple of days ago, but received no response. It seems that
> each_element and each_element_with_attribute should include an option
> to recurse through all the descendents, but unfortuantely it doesn't
> seem to (or at least I couldn't find it).

Thanks! This is what I'm looking for. I read through the tutorial and
the rdoc documentation but I just couldn't figure out what I was missing.

When I mentioned iterating through the document, what I'm really doing
is describing the process I've been using for deciding how to handle
some arbitrary XML document I wound up with. It's not ideal, I admit. It
might do me some good to read up on XML.
--Michael