Class: ODDB::Import::Whocc::Atc

Inherits:
Xml show all
Defined in:
lib/oddb/import/whocc.rb

Instance Method Summary collapse

Methods inherited from Xml

#import

Instance Method Details

#import_document(doc) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/oddb/import/whocc.rb', line 13

def import_document(doc)
  REXML::XPath.each(doc, '//rs:data/rw:row', 
    "rs" => 'urn:schemas-microsoft-com:rowset',
    "rw" => '#RowsetSchema') { |row|
    code = row.attributes['ATCCode']
    atc = Drugs::Atc.find_by_code(code) || Drugs::Atc.new(code)
    atc.name.de = row.attributes['Name']
    atc.save
  }
end