def doc
      unless body.empty?
        doc_class = if html?
                      Nokogiri::HTML::Document
                    elsif rss? || atom? || xml? || xsl?
                      Nokogiri::XML::Document
                    end

        if doc_class
          begin
            @doc ||= doc_class.parse(body, @url.to_s, content_charset)
          rescue
          end
        end
      end
    end
def doc
      unless body.empty?
        doc_class = if html?
                      Nokogiri::HTML::Document
                    elsif rss? || atom? || xml? || xsl?
                      Nokogiri::XML::Document
                    end

        if doc_class
          begin
            @doc ||= doc_class.parse(body, @url.to_s, content_charset)
          rescue
          end
        end
      end
    end
Returns a parsed document object for HTML, XML, RSS and Atom pages.

 @return [Nokogiri::HTML::Document, Nokogiri::XML::Document, nil]
   The document that represents HTML or XML pages.
   Returns `nil` if the page is neither HTML, XML, RSS, Atom or if
   the page could not be parsed properly.

 @see http://nokogiri.rubyforge.org/nokogiri/Nokogiri/XML/Document.html
 @see http://nokogiri.rubyforge.org/nokogiri/Nokogiri/HTML/Document.html