Class: TopPred::Parser_XML::LibXML

Inherits:
DOM show all
Defined in:
lib/transmembrane/toppred.rb

Instance Method Summary collapse

Methods inherited from DOM

#to_index

Methods included from TopPred::Parser_XML

new, #parse

Methods included from TopPred::Parser

#add_sequences_to_segments, #file_to_index, filetype, new

Instance Method Details

#get_root_node_from_io(io, &block) ⇒ Object



348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/transmembrane/toppred.rb', line 348

def get_root_node_from_io(io, &block)
  # turn off warnings because this doesn't seem to work:
  # XML::Parser.default_load_external_dtd = false
  # (There is a warning about not finding DTD)
  xml_parser_warnings = XML::Parser.default_warnings
  XML::Parser.default_warnings = false
  doc = XML::Parser.io(io).parse
  root = doc.root
  block.call(root)
  # reset the warning level of XML::Parser:
  XML::Parser.default_warnings = xml_parser_warnings
end