Class: ContentMetadataDS

Inherits:
ActiveFedora::NokogiriDatastream
  • Object
show all
Defined in:
lib/datastreams/content_metadata_ds.rb

Instance Method Summary collapse

Instance Method Details

#public_xmlObject



3
4
5
6
7
8
9
10
# File 'lib/datastreams/content_metadata_ds.rb', line 3

def public_xml
  result = self.ng_xml.clone
  result.xpath('/contentMetadata/resource[not(file[(@deliver="yes" or @publish="yes")])]').each { |n| n.remove }
  result.xpath('/contentMetadata/resource/file[not(@deliver="yes" or @publish="yes")]').each { |n| n.remove }
  result.xpath('/contentMetadata/resource/file').xpath('@preserve|@shelve|@publish|@deliver').each { |n| n.remove }
  result.xpath('/contentMetadata/resource/file/checksum').each { |n| n.remove }
  result
end