From: Jeff Wood Date: 2005-10-14T21:02:47+09:00 Subject: Re: Unit Testing with REXML questions ------=_Part_16167_15320578.1129291364849 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline one specific or all tags??? But, you should be able to do: root.elements( "/a/d" ).size and that should return the count of ALL elements under any tag root.elements( "/a[1]/d" ).size should return the count of elements under the first tag ( it does appear that the index operator in xpath is one-based not zero-based ). Hope that helps. j. On 10/14/05, Peter Fitzgibbons wrote: > > Hello all, > > I'm using REXML to build some XML from a rails app. I'm unit testing > the output also using REXML... and I have these questions : > > Given > > > one > two > > three > four > > > > I want to use XPath to tell me how many there are under ? > > I want to use XPath to iterate the _names_ of the items under > (Does this make sense in XML World. This one is not necessarily a > requirement, but I uncovered this need while experimenting in IRB.) ? > > Thanks in advance! > Peter Fitzgibbons > > -- "http://ruby-lang.org -- do you ruby?" Jeff Wood ------=_Part_16167_15320578.1129291364849--