Sha256: 08c818c903e0d82eaf514948f00194af9a197e3f5fd3a4ed287b0d2bb1c52512
Contents?: true
Size: 665 Bytes
Versions: 13
Compression:
Stored size: 665 Bytes
Contents
require "nokogiri" module RelatonIetf class XMLParser < RelatonBib::XMLParser class << self 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 private def item_data(ietfitem) data = super ext = ietfitem.at "./ext" return data unless ext data[:doctype] = ext.at("./doctype")&.text data end end end end
Version data entries
13 entries across 13 versions & 1 rubygems