def escape(value)
      if value.class == String
        value.gsub(/['"&<>]/) do |match|
          CONVERSION_TABLE.assoc(match).last
        end
      else
        value
      end
    end
def escape(value)
      if value.class == String
        value.gsub(/['"&<>]/) do |match|
          CONVERSION_TABLE.assoc(match).last
        end
      else
        value
      end
    end
it's fast.  see http://groups.google.com/group/ruby-talk-google/browse_thread/thread/c0280bab8a037184/9b8ca81c2607189d?hl=en&ie=UTF-8