class Nokogiri::XML::SAX::Parser

def initialize(doc = XML::SAX::Document.new, encoding = 'ASCII')

def initialize(doc = XML::SAX::Document.new, encoding = 'ASCII')
  @encoding = encoding
  @document = doc
end

def parse thing

IO object.
Parse given +thing+ which may be a string containing xml, or an
##
def parse thing
  if thing.respond_to?(:read) && thing.respond_to?(:close)
    parse_io(thing)
  else
    parse_memory(thing)
  end
end

def parse_file filename

Parse a file with +filename+
##
def parse_file filename
  raise Errno::ENOENT unless File.exists?(filename)
  raise Errno::EISDIR if File.directory?(filename)
  native_parse_file filename
end

def parse_io io, encoding = 'ASCII'

Parse given +io+
##
def parse_io io, encoding = 'ASCII'
  @encoding = encoding
  native_parse_io io, ENCODINGS[@encoding] || ENCODINGS['ASCII']
end