Module: ActiveSupport::XmlMini_NokogiriSAX

Extended by:
XmlMini_NokogiriSAX
Included in:
XmlMini_NokogiriSAX
Defined in:
lib/active_support/xml_mini/nokogirisax.rb

Overview

:nodoc:

Defined Under Namespace

Classes: HashBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#document_classObject

Returns the value of attribute document_class.



67
68
69
# File 'lib/active_support/xml_mini/nokogirisax.rb', line 67

def document_class
  @document_class
end

Instance Method Details

#parse(data) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/active_support/xml_mini/nokogirisax.rb', line 70

def parse(data)
  if !data.respond_to?(:read)
    data = StringIO.new(data || '')
  end

  if data.eof?
    {}
  else
    document = self.document_class.new
    parser = Nokogiri::XML::SAX::Parser.new(document)
    parser.parse(data)
    document.hash
  end
end