# File lib/data_table.rb, line 140
  def read
    if(location =~ /ecogrid/)
      #we need to pull out the docid and do a read on metacat
      #get self.location, and pull out the string after the last "/"
      uri = URI.parse(PATH_TO_METACAT)
      uri.query = "action=read&qformat=xml&docid=#{docid}"
      # Use Net:HTTP first to get the content_type
      http = Net::HTTP.start(uri.host, uri.port)
      http.request_get(uri.to_s) do |response|
        if(response.content_type == 'text/xml')
          # error message
          doc = REXML::Document.new(response.read_body)
          if(doc.root.name == 'error')
            raise doc.root.text
          else
            raise "Unrecognized response from metacat at #{PATH_TO_METACAT}"
          end
        elsif(response.content_type == 'text/plain')
          response.read_body do |f|
            yield f
          end
        else
          raise "Unrecognized content type \"#{response.content_type}\" " +
                "from metacat at #{PATH_TO_METACAT}"
        end
      end
    elsif(location =~ /http/)
      uri = URI.parse(location)
      http = Net::HTTP.start(uri.host, uri.port)
      http.request_get(uri.to_s) do |response|
        response.read_body do |f|
          yield f
        end
      end
    else
      raise 'Unknown location for dataTable'
    end
  end