From: Aaron Patterson Date: 2008-11-14T00:31:47+09:00 Subject: Re: [ANN] nokogiri 1.0.5 Released On Thu, Nov 13, 2008 at 05:44:50PM +0900, Dingding Ye wrote: > hi. > > Is nested search supported? > > For example, > > xml = > "subbody1subbody2" > doc.xpath("//body").each do |body| > puts body.at("subbody").content > end > > I expected to see > > subbody1 > subbody2 > > but seems it always use the root element. Yes. Try using an xpath search as such: xml = "subbody1subbody2" Nokogiri::XML(xml).xpath("//body").each do |body| puts body.at(".//subbody").content end -- Aaron Patterson http://tenderlovemaking.com/