Class: DS::Source::TeiXML

Inherits:
BaseSource show all
Defined in:
lib/ds/source/tei_xml.rb

Constant Summary collapse

TYPE =
DS::Constants::TEI_XML

Instance Method Summary collapse

Methods inherited from BaseSource

#load_source, #source_type, #to_s

Methods included from SourceCache

#cache, #find_or_open_source, #max_cache_size, #max_cache_size=

Instance Method Details

#open_source(source_file_path) ⇒ Nokogiri::XML::Document

Opens a TEI XML file at the given path and returns it as a Nokogiri::XML object.

NB: Namespaces are stripped from the document.

Parameters:

  • source_file_path (String) —

    the path to the source file

Returns:

  • (Nokogiri::XML::Document) —

    the contents of the source file as a Nokogiri::XML object



15
16
17
18
19
# File 'lib/ds/source/tei_xml.rb', line 15

def open_source source_file_path
  xml = File.open(source_file_path) { |f| Nokogiri::XML f }
  xml.remove_namespaces!
  xml
end