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.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/diaspora_federation/parsers/xml_parser.rb', line 14 def parse(root_node) from_xml_sanity_validation(root_node) hash = root_node.element_children.uniq(&:name).to_h {|child| property, type = find_property_for(child.name) if property value = parse_element_from_node(child.name, type, root_node) [property, value] else [child.name, child.text] end } [hash] end |