class Nokogiri::XML::Document

def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &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 an XML file. +string_or_io+ may be a String, or any object that
#
def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block
  options = Nokogiri::XML::ParseOptions.new(options) if Fixnum === options
  # Give the options to the user
  yield options if block_given?
  doc = if string_or_io.respond_to?(:read)
    url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil
    read_io(string_or_io, url, encoding, options.to_i)
  else
    # read_memory pukes on empty docs
    return new if string_or_io.nil? or string_or_io.empty?
    read_memory(string_or_io, url, encoding, options.to_i)
  end
  # do xinclude processing
  doc.do_xinclude(options) if options.xinclude?
  return doc
end