1

Had RTFM'ed, but still puzzled. I need to get objects which satisfy at least one of the property condition list.

E.g. divs, where class == "marked" OR class = "data" OR class = "comments"

For now emulated it manually, but is it possible with Hpricot standard abilities?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
Meredian
  • 930
  • 8
  • 23

1 Answers1

2
doc = Hpricot.parse(..your data...)
divs = doc.search("//div[@class='marked' or @class='data' or @class='comments']")

The search takes an xpath expression, and xpath allows logical and and or operators. See this great answer about a similar question: XPATH Multiple Element Filters.

Community
  • 1
  • 1
Dylan Markow
  • 123,080
  • 26
  • 284
  • 201