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.



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

def document_class
  @document_class
end

Instance Method Details

#parse(data) ⇒ Object



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

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

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