From: zerohalo Date: 2005-08-29T04:36:22+09:00 Subject: Re: Help needed with rexml 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). Maybe that could be added to a new release of rexml (if the dev is reading this?)