Module: XmlMini_LibXML
Instance Method Summary collapse
-
#parse(data) ⇒ Object
Parse an XML Document string or IO into a simple hash using libxml.
Instance Method Details
#parse(data) ⇒ Object
Parse an XML Document string or IO into a simple hash using libxml.
- data
-
XML Document string or IO to parse
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/xml_mini/libxml.rb', line 9 def parse(data) if !data.respond_to?(:read) data = StringIO.new(data || '') end char = data.getc if char.nil? {} else data.ungetc(char) LibXML::XML::Parser.io(data).parse.to_hash end end |