From: Lars Christensen Date: 2009-02-20T20:14:49+09:00 Subject: Re: Ignoring Exceptions On Feb 20, 11:14 am, Lin Wj wrote: > i am using hpricot to parse xml and place it into an object named 'x' > > some_variable = (x.at("some_element_name").innerHTML >                  if x.at("some_element_name")) > > problem is i have a TON of"some_element_name" to assign > and i dont want to do a if check for everyone of them > > is there anyway to do a straight > > some_variable = x.at("some_element_name").innerHTML > > any ideas ? Make a function that does the work for you? def html_from_element(x, name) elem = x.at(name) return elem && elem.innerHTML end