Class: RelatonIetf::XMLParser

Inherits:
RelatonBib::XMLParser
  • Object
show all
Defined in:
lib/relaton_ietf/xml_parser.rb

Class Method Summary collapse

Class Method Details

.from_xml(xml) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/relaton_ietf/xml_parser.rb', line 6

def from_xml(xml)
  doc = Nokogiri::XML(xml)
  doc.remove_namespaces!
  ietfitem = doc.at("/bibitem|/bibdata")
  if ietfitem
    RelatonIetf::IetfBibliographicItem.new(item_data(ietfitem))
  elsif
    warn "[relato-ietf] can't find bibitem or bibdata element in the XML"
  end
end