marc 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +5 -0
- data/Rakefile +1 -1
- data/lib/marc/xmlreader.rb +2 -1
- data/test/one.xml +55 -0
- data/test/tc_xml.rb +7 -1
- metadata +3 -2
data/Changes
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v0.1.8 Tue Nov 13 22:51:03 EST 2007
|
2
|
+
- added examples directory
|
3
|
+
- fixed problem with leading whitespace and the leader in xml reader
|
4
|
+
(thanks Morgan Cundiff)
|
5
|
+
|
1
6
|
v0.1.7 Mon Nov 12 09:33:57 EST 2007
|
2
7
|
- updated Record.to_marc documentation to be a bit more precise
|
3
8
|
- removed doc references to MARC::Field which is no longer around
|
data/Rakefile
CHANGED
data/lib/marc/xmlreader.rb
CHANGED
@@ -60,11 +60,12 @@ module MARC
|
|
60
60
|
event = @parser.pull
|
61
61
|
|
62
62
|
if event.text?
|
63
|
-
text += REXML::Text::unnormalize(event[0]
|
63
|
+
text += REXML::Text::unnormalize(event[0])
|
64
64
|
next
|
65
65
|
end
|
66
66
|
|
67
67
|
if event.start_element?
|
68
|
+
text = ''
|
68
69
|
attrs = event[1]
|
69
70
|
case strip_ns(event[0])
|
70
71
|
when 'controlfield'
|
data/test/one.xml
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
|
3
|
+
<record>
|
4
|
+
<leader> njm a22 uu 4500</leader>
|
5
|
+
<controlfield tag="001">afc99990058366</controlfield>
|
6
|
+
<controlfield tag="003">DLC</controlfield>
|
7
|
+
<controlfield tag="005">20071104155141.9</controlfield>
|
8
|
+
<controlfield tag="007">sd ummunniauub</controlfield>
|
9
|
+
<controlfield tag="008">071103s1939 xxufmnne||||||||| u eng||</controlfield>
|
10
|
+
<datafield tag="010" ind1=" " ind2=" ">
|
11
|
+
<subfield code="a">afc99990058366</subfield>
|
12
|
+
</datafield>
|
13
|
+
<datafield tag="040" ind1=" " ind2=" ">
|
14
|
+
<subfield code="a">DLC</subfield>
|
15
|
+
<subfield code="c">DLC</subfield>
|
16
|
+
</datafield>
|
17
|
+
<datafield tag="245" ind1="0" ind2="4">
|
18
|
+
<subfield code="a">The Texas ranger</subfield>
|
19
|
+
<subfield code="h">[sound recording] /</subfield>
|
20
|
+
<subfield code="c">Sung by Beale D. Taylor.</subfield>
|
21
|
+
</datafield>
|
22
|
+
<datafield tag="260" ind1=" " ind2=" ">
|
23
|
+
<subfield code="a">Medina, Texas,</subfield>
|
24
|
+
<subfield code="c">1939.</subfield>
|
25
|
+
</datafield>
|
26
|
+
<datafield tag="300" ind1=" " ind2=" ">
|
27
|
+
<subfield code="a">1 sound disc :</subfield>
|
28
|
+
<subfield code="b">analog, 33 1/3 rpm, mono. ;</subfield>
|
29
|
+
<subfield code="c">12 in.</subfield>
|
30
|
+
</datafield>
|
31
|
+
<datafield tag="651" ind1=" " ind2="0">
|
32
|
+
<subfield code="a">Medina</subfield>
|
33
|
+
<subfield code="z">Texas</subfield>
|
34
|
+
<subfield code="z">United States of America.</subfield>
|
35
|
+
</datafield>
|
36
|
+
<datafield tag="700" ind1="1" ind2=" ">
|
37
|
+
<subfield code="a">Lomax, John Avery, 1867-1948</subfield>
|
38
|
+
<subfield code="e">Recording engineer.</subfield>
|
39
|
+
</datafield>
|
40
|
+
<datafield tag="700" ind1="1" ind2=" ">
|
41
|
+
<subfield code="a">Lomax, Ruby T. (Ruby Terrill)</subfield>
|
42
|
+
<subfield code="e">Recording engineer.</subfield>
|
43
|
+
</datafield>
|
44
|
+
<datafield tag="700" ind1="1" ind2=" ">
|
45
|
+
<subfield code="a">Taylor, Beale D.</subfield>
|
46
|
+
<subfield code="e">Singer.</subfield>
|
47
|
+
</datafield>
|
48
|
+
<datafield tag="852" ind1=" " ind2=" ">
|
49
|
+
<subfield code="a">American Folklife Center, Library of Congress</subfield>
|
50
|
+
</datafield>
|
51
|
+
<datafield tag="852" ind1=" " ind2=" ">
|
52
|
+
<subfield code="a">DLC</subfield>
|
53
|
+
</datafield>
|
54
|
+
</record>
|
55
|
+
</collection>
|
data/test/tc_xml.rb
CHANGED
@@ -28,7 +28,13 @@ class XMLTest < Test::Unit::TestCase
|
|
28
28
|
def test_read_string
|
29
29
|
xml = File.new('test/batch.xml').read
|
30
30
|
reader = MARC::XMLReader.new(StringIO.new(xml))
|
31
|
-
assert_equal reader.entries.length
|
31
|
+
assert_equal 2, reader.entries.length
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_leader_from_xml
|
35
|
+
reader = MARC::XMLReader.new('test/one.xml')
|
36
|
+
record = reader.entries[0]
|
37
|
+
assert_equal ' njm a22 uu 4500', record.leader
|
32
38
|
end
|
33
39
|
|
34
40
|
def test_read_write
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: marc
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 0.1.8
|
7
|
+
date: 2007-11-13 00:00:00 -05:00
|
8
8
|
summary: A ruby library for working with Machine Readable Cataloging
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- test/batch.dat
|
46
46
|
- test/batch.xml
|
47
47
|
- test/one.dat
|
48
|
+
- test/one.xml
|
48
49
|
- test/tc_controlfield.rb
|
49
50
|
- test/tc_datafield.rb
|
50
51
|
- test/tc_dublincore.rb
|