Method: CoreLibrary::XmlHelper.deserialize_xml_to_array

Defined in:
lib/apimatic-core/utilities/xml_helper.rb

.deserialize_xml_to_array(xml, root_element_name, item_name, clazz, datetime_format = nil) ⇒ Object

Deserializes XML to an array of a specific class.

Parameters:

  • xml (String)

    The XML value to deserialize.

  • root_element_name (String)

    Root element name for the XML provided.

  • item_name (String)

    Item name for XML.

  • clazz (Class)

    The class to convert the XML into.



151
152
153
154
155
156
157
# File 'lib/apimatic-core/utilities/xml_helper.rb', line 151

def deserialize_xml_to_array(xml, root_element_name, item_name, clazz,
                             datetime_format = nil)
  doc = Nokogiri::XML::Document.parse xml
  from_element_to_array(doc, item_name, clazz,
                        wrapping_element_name: root_element_name,
                        datetime_format: datetime_format)
end