From: Mark Thomas Date: 2008-11-14T01:02:10+09:00 Subject: Re: nokogiri 1.0.5 Released On Nov 13, 3:44 am, Dingding Ye wrote: > [Note:  parts of this message were removed to make it a legal post.] > > 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. Let me try to clear up the confusion. at() is from Hpricot, and it searches from the root node. It is typically used as doc.at('element') search() is also from Hpricot, and it searches from the current node. This is perhaps the behavior you were expecting. An alias is '/', as in doc/"html/body" xpath() is like find() from libxml and you can nest those calls too. Note that the Hpricot xpath(), which returns the path to the node, is available in Nokogiri as path(). -- Mark.