class Nokogiri::HTML::Document

def self.new(*args) # :nodoc:

:nodoc:
def self.new(*args) # :nodoc:
  uri         = args[0]
  external_id = args[1]
  doc = wrap(LibXML.htmlNewDoc(uri, external_id))
  doc.send :initialize, *args
  doc
end

def self.read_io(io, url, encoding, options) # :nodoc:

:nodoc:
def self.read_io(io, url, encoding, options) # :nodoc:
  wrap_with_error_handling do
    LibXML.htmlReadIO(IoCallbacks.reader(io), nil, nil, url, encoding, options)
  end
end

def self.read_memory(string, url, encoding, options) # :nodoc:

:nodoc:
def self.read_memory(string, url, encoding, options) # :nodoc:
  wrap_with_error_handling do
    LibXML.htmlReadMemory(string, string.length, url, encoding, options)
  end
end

def fragment tags

Create a Nokogiri::XML::DocumentFragment from +tags+
###
def fragment tags
  DocumentFragment.new(self, tags)
end

def initialize *args

def initialize *args
  super
end

def meta_encoding # :nodoc:

:nodoc:
def meta_encoding # :nodoc:
  LibXML.htmlGetMetaEncoding(cstruct)
end

def meta_encoding=(encoding) # :nodoc:

:nodoc:
def meta_encoding=(encoding) # :nodoc:
  LibXML.htmlSetMetaEncoding(cstruct, encoding)
  encoding
end

def parse string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block

Nokogiri::XML::ParseOptions.
Nokogiri::XML::ParseOptions::RECOVER. See the constants in
is a number that sets options in the parser, such as
encoding that should be used when processing the document. +options+
+url+ is resource where this document is located. +encoding+ is the
responds to _read_ and _close_ such as an IO, or StringIO.
Parse HTML. +thing+ may be a String, or any object that
##
def parse string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block
  options = Nokogiri::XML::ParseOptions.new(options) if Fixnum === options
  # Give the options to the user
  yield options if block_given?
  if string_or_io.respond_to?(:encoding)
    encoding ||= string_or_io.encoding.name
  end
  if string_or_io.respond_to?(:read)
    url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil
    return self.read_io(string_or_io, url, encoding, options.to_i)
  end
  # read_memory pukes on empty docs
  return self.new if string_or_io.nil? or string_or_io.empty?
  self.read_memory(string_or_io, url, encoding, options.to_i)
end

def serialize *args

Serialize this Document with +encoding+ using +options+
###
def serialize *args
  if args.first && !args.first.is_a?(Hash)
    $stderr.puts(<<-eowarn)
.class}#serialize(encoding, save_opts) is deprecated and will be removed in
ri version 1.4.0 *or* after June 1 2009.
lled serialize from here:
ller.join("\n")}
 change to #{self.class}#serialize(:encoding => enc, :save_with => opts)
    eowarn
  end
  options = args.first.is_a?(Hash) ? args.shift : {
    :encoding   => args[0],
    :save_with  => args[1] || XML::Node::SaveOptions::FORMAT |
      XML::Node::SaveOptions::AS_HTML |
      XML::Node::SaveOptions::NO_DECLARATION |
      XML::Node::SaveOptions::NO_EMPTY_TAGS
  }
  super(options)
end