Class: IETFBib::XMLParser

Inherits:
IsoBibItem::XMLParser
  • Object
show all
Defined in:
lib/ietfbib/xml_parser.rb

Class Method Summary collapse

Class Method Details

.from_xml(xml) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ietfbib/xml_parser.rb', line 6

def from_xml(xml)
  doc = Nokogiri::XML(xml)
  IsoBibItem::BibliographicItem.new( 
    id:           fetch_id(doc),
    docid:        fetch_docid(doc),
    edition:      doc.at('/bibitem/edition')&.text,
    language:     doc.xpath('/bibitem/language').map(&:text),
    script:       doc.xpath('/bibitem/script').map(&:text),
    titles:       fetch_titles(doc),
    type:         doc.at('bibitem')&.attr(:type),
    ics:          fetch_ics(doc),
    dates:        fetch_dates(doc),
    contributors: fetch_contributors(doc),
    workgroup:    fetch_workgroup(doc),
    abstract:     fetch_abstract(doc),
    copyright:    fetch_copyright(doc),
    link:         fetch_link(doc),
    relations:    fetch_relations(doc),
    series:       fetch_series(doc)
  )
end