Class: DiasporaFederation::Parsers::XmlParser
- Inherits:
-
BaseParser
- Object
- BaseParser
- DiasporaFederation::Parsers::XmlParser
- Defined in:
- lib/diaspora_federation/parsers/xml_parser.rb
Overview
This is a parser of XML serialized object. Explanations about the XML data format can be found here.
Direct Known Subclasses
Instance Method Summary collapse
-
#parse(root_node) ⇒ Array[1]
Comprehensive data for an entity instantiation.
Methods inherited from BaseParser
Constructor Details
This class inherits a constructor from DiasporaFederation::Parsers::BaseParser
Instance Method Details
#parse(root_node) ⇒ Array[1]
Returns comprehensive data for an entity instantiation.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/diaspora_federation/parsers/xml_parser.rb', line 12 def parse(root_node) from_xml_sanity_validation(root_node) hash = root_node.element_children.map {|child| xml_name = child.name property = entity_type.find_property_for_xml_name(xml_name) if property type = class_properties[property] value = parse_element_from_node(xml_name, type, root_node) [property, value] else [xml_name, child.text] end }.to_h [hash] end |