eadsax 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +2 -0
  4. data/Gemfile +17 -0
  5. data/Gemfile.lock +34 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.rdoc +14 -0
  8. data/Rakefile +50 -0
  9. data/VERSION +1 -0
  10. data/bin/eadsax +48 -0
  11. data/lib/eadsax.rb +75 -0
  12. data/lib/eadsax/accessrestrict.rb +15 -0
  13. data/lib/eadsax/accruals.rb +14 -0
  14. data/lib/eadsax/acqinfo.rb +14 -0
  15. data/lib/eadsax/address.rb +7 -0
  16. data/lib/eadsax/altformavail.rb +15 -0
  17. data/lib/eadsax/appraisal.rb +15 -0
  18. data/lib/eadsax/archdesc.rb +37 -0
  19. data/lib/eadsax/arrangement.rb +14 -0
  20. data/lib/eadsax/bibliography.rb +21 -0
  21. data/lib/eadsax/bioghist.rb +17 -0
  22. data/lib/eadsax/blockquote.rb +12 -0
  23. data/lib/eadsax/change.rb +8 -0
  24. data/lib/eadsax/chronitem.rb +9 -0
  25. data/lib/eadsax/chronlist.rb +9 -0
  26. data/lib/eadsax/components.rb +59 -0
  27. data/lib/eadsax/container.rb +8 -0
  28. data/lib/eadsax/controlaccess.rb +25 -0
  29. data/lib/eadsax/custodhist.rb +16 -0
  30. data/lib/eadsax/dao.rb +7 -0
  31. data/lib/eadsax/daodesc.rb +14 -0
  32. data/lib/eadsax/defitem.rb +8 -0
  33. data/lib/eadsax/did.rb +23 -0
  34. data/lib/eadsax/div.rb +15 -0
  35. data/lib/eadsax/dsc.rb +19 -0
  36. data/lib/eadsax/ead.rb +9 -0
  37. data/lib/eadsax/eadheader.rb +10 -0
  38. data/lib/eadsax/editionstmt.rb +8 -0
  39. data/lib/eadsax/filedesc.rb +11 -0
  40. data/lib/eadsax/fileplan.rb +15 -0
  41. data/lib/eadsax/frontmatter.rb +8 -0
  42. data/lib/eadsax/index.rb +17 -0
  43. data/lib/eadsax/indexentry.rb +21 -0
  44. data/lib/eadsax/list.rb +10 -0
  45. data/lib/eadsax/listhead.rb +8 -0
  46. data/lib/eadsax/namegrp.rb +17 -0
  47. data/lib/eadsax/note.rb +13 -0
  48. data/lib/eadsax/notestmt.rb +7 -0
  49. data/lib/eadsax/odd.rb +17 -0
  50. data/lib/eadsax/originalsloc.rb +15 -0
  51. data/lib/eadsax/origination.rb +22 -0
  52. data/lib/eadsax/otherfindaid.rb +21 -0
  53. data/lib/eadsax/phystech.rb +15 -0
  54. data/lib/eadsax/prefercite.rb +15 -0
  55. data/lib/eadsax/processinfo.rb +15 -0
  56. data/lib/eadsax/profiledesc.rb +9 -0
  57. data/lib/eadsax/publicationstmt.rb +11 -0
  58. data/lib/eadsax/relatedmaterial.rb +21 -0
  59. data/lib/eadsax/revisiondesc.rb +8 -0
  60. data/lib/eadsax/row.rb +7 -0
  61. data/lib/eadsax/scopecontent.rb +8 -0
  62. data/lib/eadsax/separatedmaterial.rb +21 -0
  63. data/lib/eadsax/seriesstmt.rb +9 -0
  64. data/lib/eadsax/table.rb +8 -0
  65. data/lib/eadsax/tbody.rb +7 -0
  66. data/lib/eadsax/tgroup.rb +9 -0
  67. data/lib/eadsax/thead.rb +7 -0
  68. data/lib/eadsax/titlepage.rb +22 -0
  69. data/lib/eadsax/titleproper.rb +8 -0
  70. data/lib/eadsax/titlestmt.rb +10 -0
  71. data/lib/eadsax/userestrict.rb +15 -0
  72. data/spec/accessrestrict_spec.rb +9 -0
  73. data/spec/acqinfo_spec.rb +8 -0
  74. data/spec/archdesc_spec.rb +9 -0
  75. data/spec/arrangement_spec.rb +11 -0
  76. data/spec/bioghist_spec.rb +23 -0
  77. data/spec/chronitem_spec.rb +11 -0
  78. data/spec/chronlist_spec.rb +11 -0
  79. data/spec/components_spec.rb +11 -0
  80. data/spec/controlaccess_spec.rb +11 -0
  81. data/spec/did_spec.rb +14 -0
  82. data/spec/dsc_spec.rb +11 -0
  83. data/spec/ead_spec.rb +9 -0
  84. data/spec/eadheader_spec.rb +9 -0
  85. data/spec/eads/example.xml +315 -0
  86. data/spec/eadsax_spec.rb +8 -0
  87. data/spec/filedesc_spec.rb +11 -0
  88. data/spec/prefercite_spec.rb +11 -0
  89. data/spec/profiledesc_spec.rb +11 -0
  90. data/spec/publicationstmt_spec.rb +11 -0
  91. data/spec/scopecontent_spec.rb +13 -0
  92. data/spec/spec_helper.rb +16 -0
  93. data/spec/titleproper_spec.rb +11 -0
  94. data/spec/titlestmt_spec.rb +11 -0
  95. data/spec/userestrict_spec.rb +11 -0
  96. data/watchr.rb +34 -0
  97. metadata +274 -0
@@ -0,0 +1,17 @@
1
+ module Eadsax
2
+ class Bioghist
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :bioghist, :class => Bioghist
6
+ element :blockquote, :class => Blockquote
7
+ element :chronlist, :class => Chronlist
8
+ element :dao, :class => Dao
9
+ element :daogrp
10
+ element :head
11
+ element :list, :class => List
12
+ elements :note, :as => :notes
13
+ elements :p, :as => :ps
14
+ element :table, :class => Table
15
+ end
16
+ end
17
+
@@ -0,0 +1,12 @@
1
+ module Eadsax
2
+ class Blockquote
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :chronlist, :class => Chronlist
6
+ element :list, :class => List
7
+ element :note, :class => Note
8
+ element :p
9
+ element :table, :class => Table
10
+ end
11
+ end
12
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Change
3
+ include SAXMachine
4
+ element :date
5
+ element :item
6
+ end
7
+ end
8
+
@@ -0,0 +1,9 @@
1
+ module Eadsax
2
+ class Chronitem
3
+ include SAXMachine
4
+ element :date
5
+ element :event
6
+ element :eventgrp
7
+ end
8
+ end
9
+
@@ -0,0 +1,9 @@
1
+ module Eadsax
2
+ class Chronlist
3
+ include SAXMachine
4
+ elements :chronitem, :as => :chronitems, :class => Chronitem
5
+ element :head
6
+ element :listhead, :class => Listhead
7
+ end
8
+ end
9
+
@@ -0,0 +1,59 @@
1
+ module Eadsax
2
+ module Componentpart
3
+ def self.included(base_class)
4
+ base_class.class_eval do
5
+ element :accessrestrict, :class => Accessrestrict
6
+ element :accruals, :class => Accruals
7
+ element :acqinfo, :class => Acqinfo
8
+ element :altformavail, :class => Altformavail
9
+ element :appraisal, :class => Appraisal
10
+ element :arrangement, :class => Arrangement
11
+ element :bibliography, :class => Bibliography
12
+ element :bioghist, :class => Bioghist
13
+ element :controlaccess, :class => Controlaccess
14
+ element :custodhist, :class => Custodhist
15
+ element :dao, :class => Dao
16
+ element :did, :class => Did
17
+ element :dsc, :class => Dsc
18
+ element :fileplan, :class => Fileplan
19
+ element :head
20
+ element :index, :class => Index
21
+ elements :note, :as => :notes, :class => Note
22
+ element :odd, :class => Odd
23
+ element :originalsloc, :class => Originalsloc
24
+ element :otherfindaid, :class => Otherfindaid
25
+ element :phystech, :class => Phystech
26
+ element :prefercite, :class => Prefercite
27
+ element :processinfo, :class => Processinfo
28
+ element :relatedmaterial, :class => Relatedmaterial
29
+ element :scopecontent, :class => Scopecontent
30
+ element :separatedmaterial, :class => Separatedmaterial
31
+ element :thead, :class => Thead
32
+ element :userestrict, :class => Userestrict
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ # define component part classes dynamically to dry them up
39
+ (1..12).to_a.reverse.each do |number|
40
+ cls = Class.new do
41
+ include SAXMachine
42
+ include Eadsax::Componentpart
43
+ part = "c%02d" % number.to_s
44
+ part_sym = part.to_sym
45
+ part_sym_plural = (part + 's').to_sym
46
+
47
+ next_part = ("c%02d" % (number + 1).to_s)
48
+ next_part_sym = next_part.to_sym
49
+ next_part_sym_plural = (next_part + 's').to_sym
50
+
51
+ element part_sym, :as => :level, :value => :level
52
+ element part_sym, :as => :identifier, :value => :id
53
+ if (number + 1 < 12)
54
+ elements next_part_sym, :as => next_part_sym_plural, :class => Eadsax.const_get(('C%02d' % (number + 1).to_s))
55
+ end
56
+ end
57
+ Eadsax.const_set 'C%02d' % number.to_s, cls
58
+ end
59
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Container
3
+ include SAXMachine
4
+ element :container, :value => :type, :as => :container_type
5
+ element :container, :as => :container_number
6
+ end
7
+ end
8
+
@@ -0,0 +1,25 @@
1
+ module Eadsax
2
+ class Controlaccess
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :controlaccess, :class => Controlaccess
8
+ elements :corpname, :as => :corpnames
9
+ elements :famname, :as => :famnames
10
+ element :function
11
+ elements :genreform, :as => :genreforms
12
+ elements :geogname, :as => :geognames
13
+ element :head
14
+ elements :list, :as => :lists, :class => List
15
+ elements :name, :as => :names
16
+ elements :note, :as => :notes, :class => Note
17
+ elements :occupation, :as => :occupations
18
+ elements :p, :as => :ps
19
+ elements :persname, :as => :persnames
20
+ elements :subject, :as => :subjects
21
+ element :table, :class => Table
22
+ element :title
23
+ end
24
+ end
25
+
@@ -0,0 +1,16 @@
1
+ module Eadsax
2
+ class Custodhist
3
+ include SAXMachine
4
+ element :acqinfo, :class => Acqinfo
5
+ element :address, :class => Address
6
+ element :blockquote, :class => Blockquote
7
+ element :chronlist, :class => Chronlist
8
+ element :custodhist, :class => Custodhist
9
+ element :head
10
+ elements :list, :as => :lists, :class => List
11
+ elements :note, :as => :notes, :class => Note
12
+ elements :p, :as => :ps
13
+ element :table, :class => Table
14
+ end
15
+ end
16
+
@@ -0,0 +1,7 @@
1
+ module Eadsax
2
+ class Dao
3
+ include SAXMachine
4
+ element :daodesc, :class => Daodesc
5
+ end
6
+ end
7
+
@@ -0,0 +1,14 @@
1
+ module Eadsax
2
+ class Daodesc
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :head
8
+ element :list, :class => List
9
+ elements :note, :as => :notes, :class => Note
10
+ elements :p, :as => :ps
11
+ element :table, :class => Table
12
+ end
13
+ end
14
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Defitem
3
+ include SAXMachine
4
+ element :item
5
+ element :label
6
+ end
7
+ end
8
+
@@ -0,0 +1,23 @@
1
+ module Eadsax
2
+ class Did
3
+ include SAXMachine
4
+ elements :abstract, :as => :abstracts
5
+ elements :container, :as => :containers#, :class => Container
6
+ elements :container, :value => :type, :as => :container_types#, :class => Container
7
+ element :dao, :class => Dao
8
+ element :daogrp
9
+ element :head
10
+ element :langmaterial
11
+ element :materialspec
12
+ element :note, :class => Note
13
+ element :origination, :class => Origination
14
+ element :physdesc
15
+ element :physloc
16
+ element :repository
17
+ element :unitdate
18
+ element :unitid
19
+ element :unittitle
20
+
21
+ end
22
+ end
23
+
@@ -0,0 +1,15 @@
1
+ module Eadsax
2
+ class Div
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :div, :class => Div
8
+ element :head
9
+ element :list, :class => List
10
+ element :note, :class => Note
11
+ element :p
12
+ element :table, :class => Table
13
+ end
14
+ end
15
+
@@ -0,0 +1,19 @@
1
+ module Eadsax
2
+ class Dsc
3
+ include SAXMachine
4
+ elements :c01, :as => :c01s, :class => C01
5
+
6
+ element :address, :class => Address
7
+ element :blockquote, :class => Blockquote
8
+ element :c
9
+ element :chronlist, :class => Chronlist
10
+ element :dsc, :class => Dsc
11
+ element :head
12
+ elements :list, :class => List
13
+ elements :note, :as => :notes, :class => Note
14
+ elements :p, :as => :ps
15
+ element :table, :class => Table
16
+ element :thead, :class => Thead
17
+ end
18
+ end
19
+
@@ -0,0 +1,9 @@
1
+ module Eadsax
2
+ class Ead
3
+ include SAXMachine
4
+ element :ead
5
+ element :archdesc, :class => Archdesc
6
+ element :eadheader, :class => Eadheader
7
+ end
8
+ end
9
+
@@ -0,0 +1,10 @@
1
+ module Eadsax
2
+ class Eadheader
3
+ include SAXMachine
4
+ element :eadid
5
+ element :filedesc, :class => Filedesc
6
+ element :profiledesc, :class => Profiledesc
7
+ element :revisiondesc, :class => Revisiondesc
8
+ end
9
+ end
10
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Editionstmt
3
+ include SAXMachine
4
+ element :edition
5
+ element :p
6
+ end
7
+ end
8
+
@@ -0,0 +1,11 @@
1
+ module Eadsax
2
+ class Filedesc
3
+ include SAXMachine
4
+ element :editionstmt, :class => Editionstmt
5
+ element :notestmt, :class => Notestmt
6
+ element :publicationstmt, :class => Publicationstmt
7
+ element :seriesstmt, :class => Seriesstmt
8
+ element :titlestmt, :class => Titlestmt
9
+ end
10
+ end
11
+
@@ -0,0 +1,15 @@
1
+ module Eadsax
2
+ class Fileplan
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :fileplan, :class => Fileplan
8
+ element :head
9
+ element :list, :class => List
10
+ element :note, :class => Note
11
+ element :p
12
+ element :table, :class => Table
13
+ end
14
+ end
15
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Frontmatter
3
+ include SAXMachine
4
+ element :div, :class => Div
5
+ element :titlepage, :class => Titlepage
6
+ end
7
+ end
8
+
@@ -0,0 +1,17 @@
1
+ module Eadsax
2
+ class Index
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :head
8
+ element :index, :class => Index
9
+ element :indexentry, :class => Indexentry
10
+ element :list, :class => List
11
+ element :listhead, :class => Listhead
12
+ element :note, :class => Note
13
+ element :p
14
+ element :table, :class => Table
15
+ end
16
+ end
17
+
@@ -0,0 +1,21 @@
1
+ module Eadsax
2
+ class Indexentry
3
+ include SAXMachine
4
+ element :corpname
5
+ element :famname
6
+ element :function
7
+ element :genreform
8
+ element :geogname
9
+ element :indexentry
10
+ element :name
11
+ element :namegrp, :class => Namegrp
12
+ element :occupation
13
+ element :persname
14
+ element :ptr
15
+ element :ptrgrp
16
+ element :ref
17
+ element :subject
18
+ element :title
19
+ end
20
+ end
21
+
@@ -0,0 +1,10 @@
1
+ module Eadsax
2
+ class List
3
+ include SAXMachine
4
+ element :defitem, :class => Defitem
5
+ element :head
6
+ element :item
7
+ element :listhead, :class => Listhead
8
+ end
9
+ end
10
+
@@ -0,0 +1,8 @@
1
+ module Eadsax
2
+ class Listhead
3
+ include SAXMachine
4
+ element :head01
5
+ element :head02
6
+ end
7
+ end
8
+
@@ -0,0 +1,17 @@
1
+ module Eadsax
2
+ class Namegrp
3
+ include SAXMachine
4
+ element :corpname
5
+ element :famname
6
+ element :function
7
+ element :genreform
8
+ element :geogname
9
+ element :name
10
+ element :note, :class => Note
11
+ element :occupation
12
+ element :persname
13
+ element :subject
14
+ element :title
15
+ end
16
+ end
17
+
@@ -0,0 +1,13 @@
1
+ module Eadsax
2
+ class Note
3
+ include SAXMachine
4
+ element :address, :class => Address
5
+ element :blockquote, :class => Blockquote
6
+ element :chronlist, :class => Chronlist
7
+ element :list, :class => List
8
+ element :note, :class => Note
9
+ element :p
10
+ element :table, :class => Table
11
+ end
12
+ end
13
+
@@ -0,0 +1,7 @@
1
+ module Eadsax
2
+ class Notestmt
3
+ include SAXMachine
4
+ element :note, :class => Note
5
+ end
6
+ end
7
+