Class: DiscoveryIndexer::InputXml::ModsxmlReader

Inherits:
Object
  • Object
show all
Defined in:
lib/discovery-indexer/reader/modsxml_reader.rb

Class Method Summary collapse

Class Method Details

.read(druid) ⇒ Nokogiri::XML::Document

reads the mods xml for the fedora object that is defined , from the purl server

Parameters:

  • druid (String)

    e.g. ab123cd4567

Returns:

  • (Nokogiri::XML::Document)

    the mods xml for the fedora object

Raises:

  • (MissingModsXml)

    if there’s no mods xml available for this druid



10
11
12
13
14
15
16
17
# File 'lib/discovery-indexer/reader/modsxml_reader.rb', line 10

def self.read(druid)
  mods_uri = "#{DiscoveryIndexer::PURL_DEFAULT}/#{druid}.mods"
  begin
    Nokogiri::XML(open(mods_uri))
  rescue
    raise DiscoveryIndexer::Errors::MissingModsPage.new(mods_uri)
  end
end