# File lib/scrubyt/core/scraping/filters/tree_filter.rb, line 4
    def evaluate(source)
      return [@final_result] if @final_result
      #Crude hack! Drop it after it will be supported in Hpricot
      if @xpath =~ /.+\/@.+$/
        @example = @xpath
        @xpath = @xpath.scan(/^(.+?)\/@/)[0][0]
      end
      result = source/@xpath

      Scrubyt.log :ACTION, "Evaluating #{@parent_pattern.name} with #{@xpath}"

      xpath_results = Hpricot::Elements === result ? result : [result]

      if @example =~ /.+\/@.+$/
        result_attribute = @example.scan(/.+\/@(.+?)$/)[0][0]
        xpath_results.map! {|r| r.attributes[result_attribute] }
      end
      if @regexp == nil
        xpath_results
      else
        regexp_results = []
        xpath_results.each do |entry|
          text = SharedUtils.prepare_text_for_comparison(result.inner_html)
          if text =~ @regexp
            regexp_results << $1
          end
        end
        regexp_results
      end
    end