eac 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,414 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <eac-cpf xmlns="urn:isbn:1-931666-33-4" xmlns:xlink="http://www.w3.org/1999/xlink"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi:schemaLocation="urn:isbn:1-931666-33-4 http://eac.staatsbibliothek-berlin.de/schema/cpf.xsd">
5
+ <control>
6
+ <recordId>beinecke.j0zpcks</recordId>
7
+ <otherRecordId localType="url">http://hdl.handle.net/10079/j0zpcks</otherRecordId>
8
+ <maintenanceStatus>new</maintenanceStatus>
9
+ <maintenanceAgency>
10
+ <agencyCode>US-CtY-BR</agencyCode>
11
+ <agencyName>Beinecke Rare Book and Manuscript Library, Yale University</agencyName>
12
+ </maintenanceAgency>
13
+ <languageDeclaration>
14
+ <language languageCode="eng">English</language>
15
+ <script scriptCode="Latn">Latin</script>
16
+ </languageDeclaration>
17
+ <conventionDeclaration>
18
+ <abbreviation>aat</abbreviation>
19
+ <citation>Art &amp; Architecture Thesaurus</citation>
20
+ </conventionDeclaration>
21
+ <conventionDeclaration>
22
+ <abbreviation>dacs</abbreviation>
23
+ <citation>Describing Archives: A Content Standard</citation>
24
+ <descriptiveNote>
25
+ <p>Records were created following DACS conventions.</p>
26
+ </descriptiveNote>
27
+ </conventionDeclaration>
28
+ <conventionDeclaration>
29
+ <abbreviation>lcnaf</abbreviation>
30
+ <citation>Library of Congress Name Authority File</citation>
31
+ </conventionDeclaration>
32
+ <conventionDeclaration>
33
+ <abbreviation>lcsh</abbreviation>
34
+ <citation>Library of Congress Subject Headings</citation>
35
+ </conventionDeclaration>
36
+ <maintenanceHistory>
37
+ <maintenanceEvent>
38
+ <eventType>created</eventType>
39
+ <eventDateTime standardDateTime="2012-05-24"> 2012 May 24</eventDateTime>
40
+ <agentType>human</agentType>
41
+ <agent>M.K.K. Yearl</agent>
42
+ </maintenanceEvent>
43
+ </maintenanceHistory>
44
+ <sources>
45
+ <source xlink:actuate="onRequest" xlink:show="new" xlink:type="simple"
46
+ xlink:href="http://lccn.loc.gov/n88007820">
47
+ <sourceEntry>Library of Congress Control Number: n 88007820</sourceEntry>
48
+ </source>
49
+ <source xlink:actuate="onRequest" xlink:show="new" xlink:type="simple"
50
+ xlink:href="http://www.oxforddnb.com/view/article/4302">
51
+ <sourceEntry>Oxford Dictionary of National Biography</sourceEntry>
52
+ </source>
53
+ </sources>
54
+ </control>
55
+ <cpfDescription>
56
+ <identity>
57
+ <entityType>person</entityType>
58
+ <nameEntry scriptCode="Latn" xml:lang="eng">
59
+ <part localType="100a">Cadell, T., </part>
60
+ <part localType="100q">(Thomas), </part>
61
+ <part localType="100d">1742-1802 </part>
62
+ <authorizedForm>lcnaf</authorizedForm>
63
+ </nameEntry>
64
+ <nameEntry scriptCode="Latn" xml:lang="eng">
65
+ <part localType="400a">Cadell, Thomas. </part>
66
+ <part localType="400d">1742-1802 </part>
67
+ <alternativeForm>lcnaf</alternativeForm>
68
+ </nameEntry>
69
+ <nameEntry scriptCode="Latn" xml:lang="eng">
70
+ <part localType="400a">Cadel, T. </part>
71
+ <part localType="400q">(Thomas), </part>
72
+ <part localType="400d">1742-1802 </part>
73
+ <alternativeForm>lcnaf</alternativeForm>
74
+ </nameEntry>
75
+ <nameEntry scriptCode="Latn" xml:lang="eng" localType="directOrder">
76
+ <part>Thomas Cadell </part>
77
+ </nameEntry>
78
+ </identity>
79
+ <description>
80
+ <existDates>
81
+ <dateRange>
82
+ <fromDate standardDate="1742-11-12">1742 November 12</fromDate>
83
+ <toDate standardDate="1802-12-27">1802 December 27</toDate>
84
+ </dateRange>
85
+ </existDates>
86
+ <places>
87
+ <place>
88
+ <placeRole>birth</placeRole>
89
+ <placeEntry vocabularySource="lcsh">Bristol (England)</placeEntry>
90
+ <date standardDate="1742">1742</date>
91
+ </place>
92
+ <place>
93
+ <placeRole>residence</placeRole>
94
+ <placeEntry vocabularySource="lcsh">London (England)</placeEntry>
95
+ <dateRange>
96
+ <fromDate notAfter="1758">1758</fromDate>
97
+ <toDate standardDate="1802">1802</toDate>
98
+ </dateRange>
99
+ </place>
100
+ </places>
101
+ <localDescription localType="sex">
102
+ <term>male</term>
103
+ </localDescription>
104
+ <languageUsed>
105
+ <language languageCode="eng">English</language>
106
+ <script scriptCode="Latn">Latin</script>
107
+ </languageUsed>
108
+ <occupations>
109
+ <occupation>
110
+ <term vocabularySource="aat">booksellers</term>
111
+ </occupation>
112
+ <occupation>
113
+ <term vocabularySource="aat">publishers</term>
114
+ </occupation>
115
+ <occupation>
116
+ <term vocabularySource="aat">stationers</term>
117
+ </occupation>
118
+ </occupations>
119
+ <biogHist>
120
+ <abstract>Thomas Cadell was born in Bristol on 12 November 1742, but spent most of
121
+ his life in London. When Cadell was fifteen, his father sent him to be an
122
+ apprentice to Andrew Millar (1707-1768), a well-regarded publisher and
123
+ bookseller who had supported the publication of Samuel Johnson's <span
124
+ localType="title" style="font-style:italic">Dictionary</span>. After seven
125
+ years, Cadell became a partner in the business and finally took it over when
126
+ Millar retired in 1767. His clients and friends were among the most influential
127
+ literary and intellectual figures of the eighteenth century and included Fanny
128
+ Burney (1752-1840), Robert Burns (1759-1796), David Hume (1711-1776), Samuel
129
+ Johnson (1709-1784), Hannah More (1745-1833), Adam Smith (1723-1790), and Tobias
130
+ Smollett (1721-1771). When Cadell retired in 1793, he gave his business to his
131
+ son, Thomas Cadell (1773-1836) and his former assistant, William Davies (d.
132
+ 1820). Before his death from an asthma attack in 1802, he enjoyed an active
133
+ retirement, fulfilling many charitable and public positions, including governor
134
+ of the Foundling Hospital and sheriff in the Walbrook ward of London.</abstract>
135
+ <chronList>
136
+ <chronItem>
137
+ <date standardDate="1742-11-12">1742 November 12</date>
138
+ <event>Born in Bristol.</event>
139
+ </chronItem>
140
+ <chronItem>
141
+ <date standardDate="1758-03-07">1758 March 7</date>
142
+ <event>Apprenticed to bookseller and publisher Andrew Millar.</event>
143
+ </chronItem>
144
+ <chronItem>
145
+ <date standardDate="1765-04">1765 April</date>
146
+ <event>Became business partner to Andrew Millar.</event>
147
+ </chronItem>
148
+ <chronItem>
149
+ <date standardDate="1767">1767</date>
150
+ <event>Took over publishing and bookselling business upon Millar's
151
+ retirement.</event>
152
+ </chronItem>
153
+ <chronItem>
154
+ <date standardDate="1769-04-01">1769 April 1</date>
155
+ <event>Married the daughter of the Reverend Thomas Jones.</event>
156
+ </chronItem>
157
+ <chronItem>
158
+ <date standardDate="1786-01">1786 January</date>
159
+ <event>Death of Cadell's wife.</event>
160
+ </chronItem>
161
+ <chronItem>
162
+ <date standardDate="1793">1793</date>
163
+ <event>Retired; left business to be run jointly by his son, Thomas Cadell,
164
+ and his assistant, William Davies.</event>
165
+ </chronItem>
166
+ <chronItem>
167
+ <date standardDate="1795">1795</date>
168
+ <event>Became a governor of the Foundling Hospital in London.</event>
169
+ </chronItem>
170
+ <chronItem>
171
+ <date standardDate="1798-03-30">1798 March 30</date>
172
+ <event>Elected alderman of Walbrook ward, City of London.</event>
173
+ </chronItem>
174
+ <chronItem>
175
+ <dateRange>
176
+ <fromDate standardDate="1798">1798</fromDate>
177
+ <toDate standardDate="1799">1799</toDate>
178
+ </dateRange>
179
+ <event>Master of the Stationers' Company.</event>
180
+ </chronItem>
181
+ <chronItem>
182
+ <date standardDate="1800">1800</date>
183
+ <event>Stockkeeper of the Stationers' Company.</event>
184
+ </chronItem>
185
+ <chronItem>
186
+ <dateRange>
187
+ <fromDate standardDate="1800">1800</fromDate>
188
+ <toDate standardDate="1801">1801></toDate>
189
+ </dateRange>
190
+ <event>Served in the office of the sheriff, Walbrook ward, City of
191
+ London.</event>
192
+ </chronItem>
193
+ <chronItem>
194
+ <date standardDate="1802-12-27">1802 December 27</date>
195
+ <event>Died from an asthma attack at home in Bloomsbury Place.</event>
196
+ </chronItem>
197
+ </chronList>
198
+ <p>Thomas Cadell was born in Bristol on 12 November 1742 to William and Mary Cadell.
199
+ At the age of fifteen, he became an apprentice to the eminent London bookseller
200
+ and publisher Andrew Millar. In London, he rose to prominence as the publisher
201
+ of some of the most successful works of the eighteenth century, including many
202
+ by Samuel Johson, Edward Gibbon, and Fanny Burney.</p>
203
+ <p>At the age of twenty-one, Cadell became Millar's partner; two years later, he
204
+ took over the business when Millar retired. Cadell maintained the business in
205
+ the same location in the Strand and is said also to have carried on Millar's
206
+ inclination towards generous payments to authors. Where Millar had given
207
+ financial support to Johnson's <span localType="title" style="font-style:italic"
208
+ >A Dictionary of the English Language</span>, Cadell gave Mrs. Piozzi five
209
+ hundred for her <span localType="title" style="font-style:italic">Letters to
210
+ Samuel Johnson</span>. On occasion, he partnered with other emininent
211
+ booksellers, including William and (later) Andrew Strahan.</p>
212
+ <p>The list of clients Cadell served amounts to a summary of influential authors of
213
+ the time. In 1770, he issued David Hume's <span localType="title"
214
+ style="font-style:italic">Essays and Treatises on Several Subjects</span>;
215
+ from 1776-1788, he published Edward Gibbon's multi-volume <span
216
+ localType="title" style="font-style:italic">History of the Decline and Fall
217
+ of the Roman Empire</span>. From 1787 on, he published the poetry of Robert
218
+ Burns. He was also a friend of Samuel Johnson and published several of his
219
+ works, including <span localType="title" style="font-style:italic">The Works of
220
+ English Poets</span>. Other authors who published with Cadell included Fanny
221
+ Burney, Hannah More, Hester Piozzi, Adam Smith, and Tobias Smollett.</p>
222
+ <p>It was the comfort of his position as a publisher that allowed Cadell to marry
223
+ the daughter of the Reverend Thomas Jones on 1 April 1769. They had two
224
+ children: a daughter who married the chaplain to King George III, Dr. Charles
225
+ Lucas Eldridge, and a son, Thomas Cadell the younger. It was to his son as well
226
+ as his assistant, William Davies, that Cadell turned over his business upon his
227
+ retirement in 1793. Even in retirement, Cadell remained an active member of
228
+ society: he was a governor of the Foundling Hospital, treasurer of the Asylum,
229
+ master of the Stationers' Company, and alderman and sheriff for the ward of
230
+ Walbrook in the City of London. Cadell died of an asthma attack on 27 December
231
+ 1802.</p>
232
+ </biogHist>
233
+ <biogHist>
234
+ <p>Highlights of Cadell's publishing career:</p>
235
+ <chronList>
236
+ <chronItem>
237
+ <date standardDate="1770">1770</date>
238
+ <event>David Hume's "Essays and Treatises on Several Subjects."</event>
239
+ </chronItem>
240
+ <chronItem>
241
+ <dateRange>
242
+ <fromDate standardDate="1770">circa 1770</fromDate>
243
+ <toDate standardDate="1780">circa 1780</toDate>
244
+ </dateRange>
245
+ <event>1770s: Samuel Johnson's political tracts.</event>
246
+ </chronItem>
247
+ <chronItem>
248
+ <date standardDate="1771">1771</date>
249
+ <event>Henry Mackenzie's "The Man of Feeling."</event>
250
+ </chronItem>
251
+ <chronItem>
252
+ <date standardDate="1775">1775</date>
253
+ <event>Samuel Johnson's "Journey to the Western Islands of
254
+ Scotland."</event>
255
+ </chronItem>
256
+ <chronItem>
257
+ <dateRange>
258
+ <fromDate standardDate="1776">1776</fromDate>
259
+ <toDate standardDate="1788">1788</toDate>
260
+ </dateRange>
261
+ <event>Edward Gibbon's "Decline and Fall of the Roman Empire."</event>
262
+ </chronItem>
263
+ <chronItem>
264
+ <dateRange>
265
+ <fromDate standardDate="1779">1779</fromDate>
266
+ <toDate standardDate="1781">1781</toDate>
267
+ </dateRange>
268
+ <event>Samuel Johnson's "The Works of English Poets."</event>
269
+ </chronItem>
270
+ <chronItem>
271
+ <date standardDate="1785">1785</date>
272
+ <event>Samuel Johnson's posthumous "Prayers and Meditations."</event>
273
+ </chronItem>
274
+ <chronItem>
275
+ <date standardDate="1786">1786</date>
276
+ <event>Hester Piozzi's "Anecdotes of the Late Samuel Johnson."</event>
277
+ </chronItem>
278
+ <chronItem>
279
+ <date standardDate="1787">1787</date>
280
+ <event>Began publishing the poetry of Robert Burns.</event>
281
+ </chronItem>
282
+ <chronItem>
283
+ <date standardDate="1788">1788</date>
284
+ <event>Hester Piozzi's "Letters to Samuel Johnson."</event>
285
+ </chronItem>
286
+ </chronList>
287
+ </biogHist>
288
+ </description>
289
+ <relations>
290
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
291
+ xlink:type="simple" xlink:href="http://nrs.harvard.edu/urn-3:FHCL.HOUGH:8822110">
292
+ <relationEntry>Burney, Fanny, 1752-1840</relationEntry>
293
+ <descriptiveNote>
294
+ <p>Published her works.</p>
295
+ </descriptiveNote>
296
+ </cpfRelation>
297
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
298
+ xlink:type="simple" xlink:href="http://nrs.harvard.edu/urn-3:FHCL.HOUGH:8822135">
299
+ <relationEntry>Cadell &amp; Davies</relationEntry>
300
+ <descriptiveNote>
301
+ <p>Firm began when Cadell bequeathed his business his son, Thomas Cadell the
302
+ younger (1773-1836) and assistant, William Davies (d. 1820).</p>
303
+ </descriptiveNote>
304
+ </cpfRelation>
305
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
306
+ xlink:type="simple" xlink:href="http://nrs.harvard.edu/urn-3:FHCL.HOUGH:8822139">
307
+ <relationEntry>Gibbon, Edward, 1737-1794</relationEntry>
308
+ <descriptiveNote>
309
+ <p>Published Gibbon's <span localType="title" style="font-style:italic">Decline
310
+ and Fall of the Roman Empire</span> giving him nearly two-thirds of
311
+ profits from sales.</p>
312
+ </descriptiveNote>
313
+ </cpfRelation>
314
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
315
+ xlink:type="simple" xlink:href="http://nrs.harvard.edu/urn-3:FHCL.HOUGH:8822136">
316
+ <relationEntry>Johnson, Samuel, 1709-1784</relationEntry>
317
+ <descriptiveNote>
318
+ <p>Friend and publisher of Johnson.</p>
319
+ </descriptiveNote>
320
+ </cpfRelation>
321
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
322
+ xlink:type="simple" xlink:href="http://nrs.harvard.edu/urn-3:FHCL.HOUGH:8822141">
323
+ <relationEntry>Millar, Andrew, 1707-1768</relationEntry>
324
+ <descriptiveNote>
325
+ <p>First an apprentice to and later a business partner to Millar; named an
326
+ executor when Millar died in 1768.</p>
327
+ </descriptiveNote>
328
+ </cpfRelation>
329
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
330
+ xlink:type="simple" xlink:href="http://hdl.handle.net/10079/tb2rc0k">
331
+ <relationEntry>More, Hannah, 1745-1833</relationEntry>
332
+ <descriptiveNote>
333
+ <p>Published her works.</p>
334
+ </descriptiveNote>
335
+ </cpfRelation>
336
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
337
+ xlink:type="simple" xlink:href="http://hdl.handle.net/10079/5tb2rp7">
338
+ <relationEntry>Smollett, T. (Tobias), 1721-1771</relationEntry>
339
+ <descriptiveNote>
340
+ <p>Published his works.</p>
341
+ </descriptiveNote>
342
+ </cpfRelation>
343
+ <cpfRelation cpfRelationType="associative" xlink:actuate="onRequest" xlink:show="new"
344
+ xlink:type="simple" xlink:href="http://hdl.handle.net/10079/2280gnr">
345
+ <relationEntry>Strahan, William, 1715-1785</relationEntry>
346
+ <descriptiveNote>
347
+ <p>Occasional partner with Strahan.</p>
348
+ </descriptiveNote>
349
+ </cpfRelation>
350
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
351
+ xlink:show="new" xlink:type="simple"
352
+ xlink:href="http://nrs.harvard.edu/urn-3:FHCL.Hough:hou01430">
353
+ <relationEntry>Autograph File: G.</relationEntry>
354
+ <descriptiveNote>
355
+ <p>Contains: Receipt for the profits from the first and second editions of
356
+ Edward Gibbon's <span localType="title" style="font-style:italic">History of
357
+ the Decline and Fall of the Roman Empire</span>; also signed by Thomas
358
+ Cadell.</p>
359
+ </descriptiveNote>
360
+ </resourceRelation>
361
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
362
+ xlink:show="new" xlink:type="simple"
363
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.d98">
364
+ <relationEntry>Autographs of English literati</relationEntry>
365
+ </resourceRelation>
366
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
367
+ xlink:show="new" xlink:type="simple"
368
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.booktrad">
369
+ <relationEntry>Book trade collection</relationEntry>
370
+ </resourceRelation>
371
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
372
+ xlink:show="new" xlink:type="simple"
373
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.burnfam">
374
+ <relationEntry>Burney family collection</relationEntry>
375
+ </resourceRelation>
376
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
377
+ xlink:show="new" xlink:type="simple"
378
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.cadell">
379
+ <relationEntry>Cadell &amp; Davies records</relationEntry>
380
+ </resourceRelation>
381
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
382
+ xlink:show="new" xlink:type="simple"
383
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.genmisc">
384
+ <relationEntry>General Collection manuscript miscellany</relationEntry>
385
+ </resourceRelation>
386
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
387
+ xlink:show="new" xlink:type="simple"
388
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.hilles">
389
+ <relationEntry>Frederick W. Hilles manuscript collection</relationEntry>
390
+ </resourceRelation>
391
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
392
+ xlink:show="new" xlink:type="simple"
393
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.liebert">
394
+ <relationEntry>Herman W. Liebert manuscript collection</relationEntry>
395
+ </resourceRelation>
396
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
397
+ xlink:show="new" xlink:type="simple"
398
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.osbmss">
399
+ <relationEntry>Manuscripts Bound in Printed Books in the Osborn
400
+ Collection</relationEntry>
401
+ </resourceRelation>
402
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
403
+ xlink:show="new" xlink:type="simple"
404
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.piozzi">
405
+ <relationEntry>Hester Lynch Piozzi collection, 1776-1930</relationEntry>
406
+ </resourceRelation>
407
+ <resourceRelation resourceRelationType="creatorOf" xlink:actuate="onRequest"
408
+ xlink:show="new" xlink:type="simple"
409
+ xlink:href="http://hdl.handle.net/10079/fa/beinecke.osbfile">
410
+ <relationEntry>Osborn Manuscript Files</relationEntry>
411
+ </resourceRelation>
412
+ </relations>
413
+ </cpfDescription>
414
+ </eac-cpf>
data/eac.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'eac/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "eac"
8
+ spec.version = Eac::VERSION
9
+ spec.authors = ["Sarah Allen", "Sarah Mei"]
10
+ spec.email = ["sarah@ultrasaurus.com", "sarahmei@gmail.com"]
11
+ spec.summary = %q{Enables parsing of EAC-CPF (Encoded Archival Context - Corporate Bodies, Persons, and Families) files. }
12
+ spec.description = %q{The initial focus is to read EAC-CPF files that represent an individual person, which will have a <cpfDescription> node. The <cpfDescription> (Corporate body, person or family description) contains information on the name structures, descriptive elements, and relationships.}
13
+ spec.homepage = "https://github.com/ultrasaurus/eac"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
data/lib/eac.rb ADDED
@@ -0,0 +1,87 @@
1
+
2
+ require 'nokogiri'
3
+
4
+ module EAC
5
+
6
+ class << self
7
+ def parse(content)
8
+ xml_doc = Nokogiri::XML(content)
9
+ entity_types = xml_doc.xpath("//ns:cpfDescription/ns:identity/ns:entityType",
10
+ ns:'urn:isbn:1-931666-33-4')
11
+ if entity_types.nil? || entity_types.length < 1
12
+ raise ArgumentError.new("entityType not found")
13
+ end
14
+ if entity_types.length > 1
15
+ puts "unexpected multiple entity types:#{entity_types.length} (choosing first)"
16
+ end
17
+ type = entity_types[0].text
18
+ entity = case type
19
+ when "person"
20
+ Person.new(xml_doc)
21
+ else
22
+ Doc.new(xml_doc)
23
+ end
24
+ end
25
+ end
26
+
27
+ class Doc
28
+ def initialize(xml_doc)
29
+ @xml = xml_doc
30
+ end
31
+ end
32
+
33
+ class Person < Doc
34
+ def initialize(xml_doc)
35
+ super
36
+ end
37
+
38
+ def names
39
+ if @names.nil?
40
+ @names = names_from_entries
41
+ end
42
+ @names
43
+ end
44
+
45
+ def names_from_entries
46
+ name_elements = []
47
+ name_entries = @xml.xpath("//ns:cpfDescription/ns:identity/ns:nameEntry",
48
+ ns:'urn:isbn:1-931666-33-4')
49
+ name_entries.each do |entry|
50
+ name_elements << Name.new(entry)
51
+ end
52
+ name_elements
53
+ end
54
+
55
+ class Name
56
+ attr_reader :parts
57
+
58
+ def initialize(xml)
59
+ @parts = []
60
+ xml_parts = xml.xpath('ns:part', ns:'urn:isbn:1-931666-33-4')
61
+ xml_parts.each do |part_data|
62
+ @parts << Part.new(part_data)
63
+ end
64
+ end
65
+
66
+ def to_s
67
+ @parts.map(&:text).join(', ')
68
+ end
69
+
70
+ class Part
71
+ attr_reader :local_type, :text
72
+
73
+ def initialize(xml)
74
+ @local_type = xml['localType']
75
+ @text = xml.text
76
+ end
77
+ end
78
+
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ def EAC(*args, &block)
85
+ EAC.parse(*args)
86
+ end
87
+