module MultiXml::Parsers::Nokogiri

def parse(xml)

XML Document string or IO to parse
xml::
Parse an XML Document string or IO into a simple hash using Nokogiri.
def parse(xml)
  if !xml.respond_to?(:read)
    xml = StringIO.new(xml || '')
  end
  char = xml.getc
  if char.nil?
    {}
  else
    xml.ungetc(char)
    doc = ::Nokogiri::XML(xml)
    raise doc.errors.first if doc.errors.length > 0
    doc.to_hash
  end
end

def parse_error; ::Nokogiri::XML::SyntaxError; end

def parse_error; ::Nokogiri::XML::SyntaxError; end