Module: Bio::BlastXMLParser::XPath

Included in:
MapXPath
Defined in:
lib/bio/db/blast/parser/nokogiri.rb

Instance Method Summary collapse

Instance Method Details

#field(name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bio/db/blast/parser/nokogiri.rb', line 9

def field name
  res = if @prefix
    @xml.xpath(@prefix+name+'/text()').to_s
  else
    @xml.xpath(name+'/text()').to_s
  end
  if res == nil
    logger = Bio::Log::LoggerPlus['bio-blastxmlparser']
    logger.warn("XML elemement <#{name}> has no content")
  end
  res.to_s
end