Method: Sequel::Plugins::XmlSerializer::ClassMethods#array_from_xml

Defined in:
lib/sequel/plugins/xml_serializer.rb

#array_from_xml(xml, opts = OPTS) ⇒ Object

Return an array of instances of this class based on the provided XML.

[View source]

132
133
134
135
136
137
138
# File 'lib/sequel/plugins/xml_serializer.rb', line 132

def array_from_xml(xml, opts=OPTS)
  node = Nokogiri::XML(xml).children.first
  unless node 
    raise Error, "Malformed XML used"
  end
  node.children.reject{|c| c.is_a?(Nokogiri::XML::Text)}.map{|c| from_xml_node(c, opts)}
end