Sha256: 0c4bb635008daac5b8cecf55b50df51f2f7f7f31df6cb38e3867d89b566e83a4
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
module RelatonNist class XMLParser < RelatonBib::XMLParser class << self def from_xml(xml) doc = Nokogiri::XML xml nistitem = doc.at("/bibitem|/bibdata") if nistitem NistBibliographicItem.new(item_data(nistitem)) elsif warn "[relato-nist] can't find bibitem or bibdata element in the XML" end end private def item_data(nistitem) data = super ext = nistitem.at "./ext" return data unless ext data[:commentperiod] = fetch_commentperiod(ext) data end def fetch_status(item) status = item.at "./status" return unless status DocumentStatus.new( stage: status.at("stage")&.text, substage: status.at("substage")&.text, iteration: status.at("iteration")&.text, ) end def fetch_commentperiod(item) cp = item.at "./commentperiod" return unless cp CommentPeriod.new( from: cp.at("from").text, to: cp.at("to")&.text, extended: cp.at("extended")&.text ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relaton-nist-0.8.1 | lib/relaton_nist/xml_parser.rb |