Method: ActiveSupport::XmlMini_LibXMLSAX#parse
- Defined in:
- activesupport/lib/active_support/xml_mini/libxmlsax.rb
#parse(data) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'activesupport/lib/active_support/xml_mini/libxmlsax.rb', line 64 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::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER) parser = LibXML::XML::SaxParser.io(data) document = self.document_class.new parser.callbacks = document parser.parse document.hash end end |