Module: Resync::XMLParser
- Defined in:
- lib/resync/xml_parser.rb
Overview
Parses ResourceSync XML documents and returns appropriate objects.
Class Method Summary collapse
-
.parse(xml) ⇒ Object
Parses the specified ResourceSync document and returns the appropriate object based on the
capabilityattribute of the root element’s metadata (i.e. <rs:md>).
Class Method Details
.parse(xml) ⇒ Object
Parses the specified ResourceSync document and returns the appropriate object based on the capability attribute of the root element’s metadata (i.e. <rs:md>).
35 36 37 38 39 40 |
# File 'lib/resync/xml_parser.rb', line 35 def self.parse(xml) root_element = XML.element(xml) mapping = root_element.name == 'sitemapindex' ? :sitemapindex : :_default root_type = find_root_type(ROOT_TYPES[mapping], root_element) root_type.load_from_xml(root_element, mapping: mapping) end |