module MultiXml::Parsers::Libxml

def parse(xml)

XML Document string or IO to parse
xml::
Parse an XML Document string or IO into a simple hash using LibXML.
def parse(xml)
  if !xml.respond_to?(:read)
    xml = StringIO.new(xml || '')
  end
  char = xml.getc
  if char.nil?
    {}
  else
    xml.ungetc(char)
    LibXML::XML::Parser.io(xml).parse.to_hash
  end
end