From: Robert Klemme Date: 2012-01-23T18:49:06+09:00 Subject: Re: A simple XPATh failing On Sun, Jan 22, 2012 at 10:25 PM, Ruby Mania wrote: > Thanks a bunch :D completely forgot the next sibling option and was > trying following-siblings :) If information should be grouped by

, I'd do a two step approach, something like this require 'nokogiri' dom = Nokogiri.HTML(< Name: PeterPan
Tag: Critical
Priority: 223

DOC dom.xpath('//p').each do |para_tag| dat = {} para_tag.xpath('span[@class="label"]').each do |span_tag| dat[span_tag.text[/\A(.*?):?\z/, 1]] = span_tag.next_sibling.text end p dat end Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/