Port of Ruby Nokogiri to D