Class: Document
- Inherits:
-
EADElement
- Object
- EADElement
- Document
- Defined in:
- lib/elements/ead.rb
Constant Summary collapse
- DTD_LOC =
'"+//ISBN 1-931666-00-8//DTD ead.dtd '+ '(Encoded Archival Description (EAD) Version 2002)//EN" "ead.dtd"'
Class Method Summary collapse
Instance Method Summary collapse
- #export(filename) ⇒ Object
-
#initialize(id, title) ⇒ Document
constructor
A new instance of Document.
- #start_partial_export(file) ⇒ Object
Constructor Details
Class Method Details
.from_file(file) ⇒ Object
10 11 12 13 |
# File 'lib/elements/ead.rb', line 10 def self.from_file(file) doc = REXML::Document.new(File.new(file)) self.import_xml(doc.elements[1]) end |
Instance Method Details
#export(filename) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/elements/ead.rb', line 20 def export(filename) doc = REXML::Document.new doc << REXML::XMLDecl.new("1.0", "UTF-8") doc << REXML::DocType.new("ead PUBLIC", DTD_LOC) create_xml(doc) output = File.open(filename, "w") doc.write(output, 0) output.write "\n" output.close end |
#start_partial_export(file) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/elements/ead.rb', line 32 def start_partial_export(file) if not already_partial_exported? file << "<?xml version='1.0' encoding='UTF-8'?>\n" file << "<!DOCTYPE ead PUBLIC #{DTD_LOC}>" super end end |