Sha256: 433e1e6155cabe17b8b527a7912d8327181dffbde199e35924655ddf990e49c5

Contents?: true

Size: 506 Bytes

Versions: 19

Compression:

Stored size: 506 Bytes

Contents

require "nokogiri"

module RelatonIetf
  class XMLParser < RelatonBib::XMLParser
    class << self
      def from_xml(xml)
        doc = Nokogiri::XML(xml)
        ietfitem = doc.at("/bibitem|/bibdata")
        RelatonIetf::IetfBibliographicItem.new(item_data(ietfitem))
      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

19 entries across 19 versions & 1 rubygems

Version Path
relaton-ietf-0.7.0 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.10 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.9 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.8 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.7 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.6 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.5 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.4 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.3 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.2 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.1 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.6.0 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.5 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.4 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.3 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.2 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.1 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.5.0 lib/relaton_ietf/xml_parser.rb
relaton-ietf-0.1.0 lib/relaton_ietf/xml_parser.rb