Class | Nokogiri::HTML::Document
In: | lib/nokogiri/html/document.rb ext/nokogiri/html_sax_parser_context.c
Parent: | Nokogiri::XML::Document

call-seq:

     type

The type for this document

### Methods

fragment meta_encoding meta_encoding= new parse read_io read_memory serialize title title= type

### Public Class methods

new

Create a new document

parse(string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML) {|options if block_given?| ...}

Parse HTML. `string_or_io` may be a String, or any object that responds to read and close such as an IO, or StringIO. `url` is resource where this document is located. `encoding` is the encoding that should be used when processing the document. `options` is a number that sets options in the parser, such as Nokogiri::XML::ParseOptions::RECOVER. See the constants in Nokogiri::XML::ParseOptions.

read_io(io, url, encoding, options)

Read the HTML document from `io` with given `url`, `encoding`, and `options`. See Nokogiri::HTML.parse

read_memory(string, url, encoding, options)

Read the HTML document contained in `string` with given `url`, `encoding`, and `options`. See Nokogiri::HTML.parse

### Public Instance methods

fragment(tags = nil)

Create a Nokogiri::XML::DocumentFragment from `tags`

meta_encoding()

Get the meta tag encoding for this document. If there is no meta tag, then nil is returned.

meta_encoding=(encoding)

Set the meta tag encoding for this document. If there is no meta content tag, the encoding is not set.

serialize(options = {})

Serialize Node using `options`. Save options can also be set using a block. See SaveOptions.

These two statements are equivalent:

     node.serialize(:encoding => 'UTF-8', :save_with => FORMAT | AS_XML)

or

      node.serialize(:encoding => 'UTF-8') do |config|
        config.format.as_xml
      end

title()

Get the title string of this document. Return nil if there is no title tag.

title=(text)

Set the title string of this document. If there is no head element, the title is not set.

type

The type for this document

[Validate]