MARC-XML-1.0.3/0000755000175000017500000000000012270121412010761 5ustar gmcgmcMARC-XML-1.0.3/MANIFEST0000644000175000017500000000105212270121412012110 0ustar gmcgmcbin/entity-escape-xml
bin/marc2xml
bin/xml2marc
Changes
lib/MARC/File/XML.pm
Makefile.PL
MANIFEST
README
t/batch-ns.t
t/batch-ns.xml
t/batch.t
t/batch.xml
t/empty-record-2.xml
t/empty-record.t
t/empty-record.xml
t/encode.t
t/error-handling.t
t/escape.mrc
t/escape.t
t/external-entities.t
t/invalid.xml
t/namespace.t
t/namespace.xml
t/parser.t
t/record.dat
t/subfield0.t
t/subfield0.xml
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
MARC-XML-1.0.3/Makefile.PL0000644000175000017500000000130212231514525012737 0ustar gmcgmcuse strict;
use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'MARC-XML',
'DISTNAME' => 'MARC-XML',
'VERSION_FROM' => 'lib/MARC/File/XML.pm',
'PMLIBDIRS' => [ qw( lib/ ) ],
'AUTHOR' => [
'Ed Summers ',
'Galen Charlton ',
],
'LICENSE' => 'perl',
'PREREQ_PM' => {
'XML::LibXML' => 1.66,
'MARC::Record' => 2.0,
'MARC::Charset' => 0.98,
},
'EXE_FILES' => [ qw( bin/marc2xml bin/xml2marc ) ]
);
MARC-XML-1.0.3/bin/0000755000175000017500000000000012270121411011530 5ustar gmcgmcMARC-XML-1.0.3/bin/xml2marc0000755000175000017500000000174612231514525013224 0ustar gmcgmc#!/usr/bin/perl
=head1 NAME
xml2marc - convert LC SlimSchema XML to MARC21
=head1 SYNOPSIS
# convert a file
% xml2marc marc.xml > marc.dat.
# or use in a pipeline
% cat marc.xml | xml2marc > marc.dat
=head1 DESCRIPTION
xml2marc is a command line utility for converting XML that uses the Library of
Congress Slim Schema to MARC21 bibliographic data. Conversion is handled using
the MARC::Record and MARC::File::XML packages.
=cut
use strict;
use warnings;
use MARC::Batch;
use MARC::File::XML;
my $file = shift;
my $fh;
## read from a file?
if ( $file ) {
fatal( "no such file: $file" ) if ! -r $file;
$fh = IO::File->new( $file );
}
## or from STDIN?
else {
$fh = \*STDIN;
}
## set up intput/output for utf8 encoding
binmode( STDOUT, ':bytes' );
binmode( $fh, ':utf8' );
my $batch = MARC::Batch->new( 'XML', $fh );
while ( my $record = $batch->next() ) {
print $record->as_usmarc();
}
sub fatal {
print STDERR shift, "\n";
exit( 1 );
}
MARC-XML-1.0.3/bin/marc2xml0000755000175000017500000000236212231514525013217 0ustar gmcgmc#!/usr/bin/perl
=head1 NAME
marc2xml - convert a MARC file to XML
=head1 SYNOPSIS
# convert a file
% marc2xml marc.dat > marc.xml
# or use in a pipeline
% cat marc.dat | marc2xml > marc.xml
=head1 DESCRIPTION
marc2xml is a command line utility for converting MARC21 bibliographic
data to XML using the Library of Congress Slim Schema. Conversion is
handled using the MARC::Record and MARC::File::XML packages.
=cut
use strict;
use warnings;
use MARC::Record;
use MARC::Batch;
use MARC::File::XML;
use IO::File;
my $file = shift;
my $fh;
## read from a file?
if ( $file ) {
fatal( "no such file: $file" ) if ! -r $file;
$fh = IO::File->new( $file );
}
## or from STDIN?
else {
$fh = \*STDIN;
}
## set up intput/output for utf8 encoding
binmode( STDOUT, ':utf8' );
binmode( $fh, ':bytes' );
my $found = 0;
my $batch = MARC::Batch->new( 'USMARC', $fh );
# be lenient, it's MARC afterall :)
$batch->warnings_off();
$batch->strict_off();
while ( my $record = $batch->next() ) {
if ( ! $found ) {
print MARC::File::XML::header();
$found = 1;
}
print MARC::File::XML::record( $record );
}
print MARC::File::XML::footer() if $found;
sub fatal {
print STDERR shift, "\n";
exit( 1 );
}
MARC-XML-1.0.3/bin/entity-escape-xml0000755000175000017500000000031712231514525015040 0ustar gmcgmc#!/usr/bin/perl
use strict;
use warnings;
use Unicode::Normalize;
binmode(STDIN,':utf8');
while (my $stuff = NFC(<>)) {
$stuff =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
print $stuff;
}
MARC-XML-1.0.3/t/0000755000175000017500000000000012270121411011223 5ustar gmcgmcMARC-XML-1.0.3/t/error-handling.t0000644000175000017500000000070112231514525014332 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 1;
use MARC::Record;
use MARC::File::XML;
open my $IN, '<', 't/invalid.xml';
my $xml = join('', <$IN>);
close $IN;
my $r;
eval { $r = MARC::Record->new_from_xml($xml, 'UTF-8'); };
if ($@) {
diag($@);
ok($@ =~ /MARCXML document has no record element/, 'failed with sensible exception message');
} else {
fail('should have thrown an exception trying to parse XML from t/invalid.xml');
}
MARC-XML-1.0.3/t/external-entities.t0000644000175000017500000000372212270121062015062 0ustar gmcgmcuse strict;
use warnings;
use MARC::Record;
use MARC::File::XML;
use File::Temp;
use Test::More tests => 2;
# we'll allow internal parsed entities
my $xml_ent = q(
]>
The original MARC format /
&avram;
);
my $marc_ent = MARC::Record->new_from_xml($xml_ent);
is($marc_ent->subfield('245', 'c'), 'Henriette Avram', 'can expand normal entity');
# external entities, however, will not be allowed unless a client
# passes an XML::LibXML::Parser via ->set_parser() that doesn't
# disable fetching external entities.
my $xml_ext_ent = q(
]>
I was run on &questionable; /
);
# the following is meant to provide a platform-independent
# external file that could be successfully retrieved if the
# parser were allowed fetch external entities; hopefully this
# will catch any changes to XML::LibXML or libxml2 that somehow
# cause ext_ent_handler to be ignored.
my $tmp = File::Temp->new();
print $tmp 'boo!';
my $filename = $tmp->filename;
if ($^O eq 'MSWin32') {
# normalize filename so that it works as
# part of a file URI, without having to require URI::file
$filename =~ s!\\!/!g;
$filename = "/$filename";
}
$xml_ext_ent =~ s!XXX!file://$filename!g;
my $marc_ext_ent;
eval {
$marc_ext_ent = MARC::Record->new_from_xml($xml_ext_ent);
};
if ($@) {
like(
$@,
qr/External entities are not supported/,
'refused to parse MARCXML record containing external entitities'
);
} else {
fail('should have refused to parse MARCXML record containing external entitities, but did not');
}
MARC-XML-1.0.3/t/subfield0.xml0000644000175000017500000000112412231514525013631 0ustar gmcgmc
-----nas-a22-----z--4500
19th century music
[electronic resource]
subfield $0 contents
MARC-XML-1.0.3/t/batch.t0000644000175000017500000000252312231514525012504 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 23;
use Data::Dumper;
use_ok( 'MARC::File::XML' );
use_ok( 'MARC::Batch' );
my $batch = MARC::Batch->new( 'XML', 't/batch.xml' );
isa_ok( $batch, 'MARC::Batch' );
my @titles = (
'ActivePerl with ASP and ADO / Tobias Martinsson.',
'Programming the Perl DBI / Alligator Descartes and Tim Bunce.',
'Perl : programmer\'s reference / Martin C. Brown.',
'Perl : the complete reference / Martin C. Brown.',
'CGI programming with Perl / Scott Guelich, Shishir Gundavaram & Gunther Birznieks.',
'Proceedings of the Perl Conference 4.0 : July 17-20, 2000, Monterey, California.',
'Perl for system administration / David N. Blank-Edelman.',
'Programming Perl / Larry Wall, Tom Christiansen & Jon Orwant.',
'Perl programmer\'s interactive workbook / Vincent Lowe.',
'Cross-platform Perl / Eric F. Johnson.',
);
my @leaders = (
'00755cam 22002414a 4500',
'00647pam 2200241 a 4500',
'00605cam 22002054a 4500',
'00579cam 22002054a 4500',
'00801nam 22002778a 4500',
'00665nam 22002298a 4500',
'00579nam 22002178a 4500',
'00661nam 22002538a 4500',
'00603cam 22002054a 4500',
'00696nam 22002538a 4500',
);
my $count = 0;
while ( my $record = $batch->next() ) {
$count++;
is( $record->leader(), shift(@leaders), "found leader $count" );
is( $record->title(), shift(@titles), "found title $count" );
}
MARC-XML-1.0.3/t/encode.t0000644000175000017500000000233612231514525012662 0ustar gmcgmcuse strict;
use warnings;
use MARC::File::XML;
use MARC::Record;
use MARC::Batch;
use Test::More tests => 8;
## create a MARC::Record object from some MARC data on disk
my $batch = MARC::Batch->new( 'USMARC', 't/record.dat' );
my $r1 = $batch->next();
## serialize the record as XML
my $xml = $r1->as_xml();
## parse the XML into another MARC::Record object
my $r2 = MARC::Record->new_from_xml( $xml );
## make sure both MARC::Record objects are the same
is( $r1->as_formatted(), $r2->as_formatted(), 'xml encode/decode style 1' );
## try alternate calling style
my $r3 = MARC::Record::new_from_xml( $xml );
is( $r1->as_formatted(), $r3->as_formatted(), 'xml encode/decode style 2' );
my $xml2 = join( "\n",
MARC::File::XML::header(),
MARC::File::XML::record( $r1 ),
MARC::File::XML::footer()
);
is ( $xml, $xml2, 'xml encode/decode style 3' );
## writing to a file
my $file = MARC::File::XML->out( 't/test.xml' );
isa_ok( $file, 'MARC::File::XML' );
ok( $file->write( $r3 ), 'write()' );
ok( $file->close(), 'close()' );
$file = MARC::File::XML->in( 't/test.xml' );
my $r4 = $file->next();
isa_ok( $r4, 'MARC::Record' );
is( $r4->as_formatted(), $r3->as_formatted(), 'writing to file works' );
unlink( 't/test.xml' );
MARC-XML-1.0.3/t/namespace.xml0000644000175000017500000000305612231514525013716 0ustar gmcgmc
-----nas-a22-----z--4500
cr |n|---|||||
0148-2076
(IlDesEIS)954925475457
NINETEENTH CENTURY MUSIC
19th century music
[electronic resource]
Made available online through EBSCO Academic Search Premier:getFullTxt
EBSCO Publishing (Firm)
Availability: from 2000
EBSCO Academic Search Premier:getFullTxt
1533-8606
MARC-XML-1.0.3/t/escape.t0000644000175000017500000000271712231514525012670 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 14;
# test escaping of < > and & for XML
use_ok( 'MARC::File::XML' );
is( MARC::File::XML::escape( 'foo&bar&baz' ), 'foo&bar&baz', '&' );
is( MARC::File::XML::escape( 'foo>bar>baz' ), 'foo>bar>baz', '>' );
is( MARC::File::XML::escape( 'foonew();
isa_ok( $r1, 'MARC::Record' );
$r1->leader( '&xyz<123>' );
$r1->append_fields(
MARC::Field->new( '005', '&abc' ),
MARC::Field->new( '245', 0, 1, a => 'Foo&Bar' )
);
my $xml1 = $r1->as_xml();
like( $xml1, qr/&xyz<123>/, 'escaped leader' );
like( $xml1, qr/&abc<def>/, 'escape control field' );
like( $xml1, qr/Foo&Bar<Baz>/, 'escaped field' );
# check escaping of subfield labels
my $b = MARC::Batch->new( 'USMARC', 't/escape.mrc' );
my $r2 = $b->next();
is($r2->subfield('650', '<'), 'France', 'read subfield $< parsed from ISO2709 blob');
my $xml2 = $r2->as_xml();
my $r3;
SKIP: {
eval { $r3 = MARC::Record->new_from_xml($xml2); };
if ($@) {
fail('failed to parse MARCXML generated from record containing a subfield $<');
skip 'no point in checking further', 1;
} else {
is($r3->subfield('650', '<'), 'France', 'read subfield $< parsed from MARCXML');
is_deeply($r2, $r3, 'record with subfield $< the same parsed from ISO2709 or MARCXML');
}
}
MARC-XML-1.0.3/t/namespace.t0000644000175000017500000000046612231514525013363 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 1;
use MARC::Batch;
# sometimes the element might have a namespace or other
# attributes on it. We need to make sure that does not mess us up.
my $b = MARC::Batch->new( 'XML', 't/namespace.xml' );
my $r = $b->next();
isa_ok( $r, 'MARC::Record' );
MARC-XML-1.0.3/t/invalid.xml0000644000175000017500000000072612231514525013411 0ustar gmcgmc
ddc
CPL
CPL
barcode2
MARC-XML-1.0.3/t/empty-record-2.xml0000644000175000017500000000010612231514525014524 0ustar gmcgmc
MARC-XML-1.0.3/t/batch.xml0000644000175000017500000005314712231514525013051 0ustar gmcgmc
00755cam 22002414a 4500
fol05731351
IMchF
20000613133448.0
000107s2000 nyua 001 0 eng
00020737
0471383147 (paper/cd-rom : alk. paper)
DLC
DLC
DLC
pcc
QA76.73.P22
M33 2000
005.13/3
21
Martinsson, Tobias,
1976-
ActivePerl with ASP and ADO /
Tobias Martinsson.
New York :
John Wiley & Sons,
2000.
xxi, 289 p. :
ill. ;
23 cm. +
1 computer laser disc (4 3/4 in.)
"Wiley Computer Publishing."
Perl (Computer program language)
Active server pages.
ActiveX.
00647pam 2200241 a 4500
fol05754809
IMchF
20000601115601.0
000203s2000 mau 001 0 eng
00022023
1565926994
DLC
DLC
DLC
pcc
QA76.73.P22
D47 2000
005.74
21
Descartes, Alligator.
Programming the Perl DBI /
Alligator Descartes and Tim Bunce.
Cmabridge, MA :
O'Reilly,
2000.
1111
p. cm.
Perl (Computer program language)
Database management.
Bunce, Tim.
00605cam 22002054a 4500
fol05843555
IMchF
20000525142739.0
000318s1999 cau b 001 0 eng
00501349
DLC
DLC
DLC
pcc
QA76.73.P22
B763 1999
005.13/3
21
Brown, Martin C.
Perl :
programmer's reference /
Martin C. Brown.
Berkeley :
Osborne/McGraw-Hill,
c1999.
xix, 380 p. ;
22 cm.
Includes bibliographical references and index.
Perl (Computer program language)
00579cam 22002054a 4500
fol05843579
IMchF
20000525142716.0
000318s1999 caua 001 0 eng
00502116
0072120002
DLC
DLC
DLC
pcc
QA76.73.P22
B762 1999
005.13/3
21
Brown, Martin C.
Perl :
the complete reference /
Martin C. Brown.
Berkeley :
Osborne/McGraw-Hill,
c1999.
xxxv, 1179 p. :
ill. ;
24 cm.
Perl (Computer program language)
00801nam 22002778a 4500
fol05848297
IMchF
20000524125727.0
000518s2000 mau 001 0 eng
00041664
1565924193
DLC
DLC
pcc
QA76.73.P22
G84 2000
005.2/762
21
Guelich, Scott.
CGI programming with Perl /
Scott Guelich, Shishir Gundavaram & Gunther Birznieks.
2nd ed., expanded & updated
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
CGI (Computer network protocol)
Internet programming.
Gundavaram, Shishir.
Birznieks, Gunther.
00665nam 22002298a 4500
fol05865950
IMchF
20000615103017.0
000612s2000 mau 100 0 eng
00055759
0596000138
DLC
DLC
pcc
QA76.73.P22
P475 2000
005.13/3
21
Perl Conference 4.0
(2000 :
Monterey, Calif.)
Proceedings of the Perl Conference 4.0 :
July 17-20, 2000, Monterey, California.
1st ed.
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
Congresses.
00579nam 22002178a 4500
fol05865956
IMchF
20000615102948.0
000612s2000 mau 000 0 eng
00055770
1565926099
DLC
DLC
pcc
QA76.73.P22
B43 2000
005.13/3
21
Blank-Edelman, David N.
Perl for system administration /
David N. Blank-Edelman.
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
00661nam 22002538a 4500
fol05865967
IMchF
20000615102611.0
000614s2000 mau 000 0 eng
00055799
0596000278
DLC
DLC
pcc
QA76.73.P22
W35 2000
005.13/3
21
Wall, Larry.
Programming Perl /
Larry Wall, Tom Christiansen & Jon Orwant.
3rd ed.
Cambridge, Mass. :
O'Reilly,
2000.
0007
p. cm.
Perl (Computer program language)
Christiansen, Tom.
Orwant, Jon.
00603cam 22002054a 4500
fol05872355
IMchF
20000706095105.0
000315s1999 njua 001 0 eng
00500678
013020868X
DLC
DLC
DLC
pcc
QA76.73.P22
L69 1999
005.13/3
21
Lowe, Vincent
(Vincent D.)
Perl programmer's interactive workbook /
Vincent Lowe.
Upper Saddle River, NJ :
Prentice Hall PTP,
c1999.
xx, 633 p. :
ill. ;
23 cm.
Perl (Computer program language)
00696nam 22002538a 4500
fol05882032
IMchF
20000707091904.0
000630s2000 cau 001 0 eng
00058174
0764547291 (alk. paper)
DLC
DLC
pcc
QA76.73.P22
F64 2000
005.13/3
21
Foster-Johnson, Eric.
Cross-platform Perl /
Eric F. Johnson.
Foster City, CA :
IDG Books Worldwide,
2000.
0009
p. cm.
Includes index.
Perl (Computer program language)
Web servers.
Cross-platform software development.
MARC-XML-1.0.3/t/subfield0.t0000644000175000017500000000042212231514525013274 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 1;
use MARC::Batch;
# verify that parser picks up contents of a subfield $0
my $b = MARC::Batch->new( 'XML', 't/subfield0.xml' );
my $r = $b->next();
is($r->subfield('245', '0'), 'subfield $0 contents', 'subfield $0');
MARC-XML-1.0.3/t/record.dat0000644000175000017500000000036012231514525013203 0ustar gmcgmc00240nam 22001092 4500008004100000040001000041245002200051260002000073300001100093900000800104952001800112891207s19xx xxu 00010 eng d cIMchF 0aAll about whales. bHoliday,c1987. a[ ] p. aALL a20571cRdALLMARC-XML-1.0.3/t/batch-ns.t0000644000175000017500000000252612231514525013125 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 23;
use Data::Dumper;
use_ok( 'MARC::File::XML' );
use_ok( 'MARC::Batch' );
my $batch = MARC::Batch->new( 'XML', 't/batch-ns.xml' );
isa_ok( $batch, 'MARC::Batch' );
my @titles = (
'ActivePerl with ASP and ADO / Tobias Martinsson.',
'Programming the Perl DBI / Alligator Descartes and Tim Bunce.',
'Perl : programmer\'s reference / Martin C. Brown.',
'Perl : the complete reference / Martin C. Brown.',
'CGI programming with Perl / Scott Guelich, Shishir Gundavaram & Gunther Birznieks.',
'Proceedings of the Perl Conference 4.0 : July 17-20, 2000, Monterey, California.',
'Perl for system administration / David N. Blank-Edelman.',
'Programming Perl / Larry Wall, Tom Christiansen & Jon Orwant.',
'Perl programmer\'s interactive workbook / Vincent Lowe.',
'Cross-platform Perl / Eric F. Johnson.',
);
my @leaders = (
'00755cam 22002414a 4500',
'00647pam 2200241 a 4500',
'00605cam 22002054a 4500',
'00579cam 22002054a 4500',
'00801nam 22002778a 4500',
'00665nam 22002298a 4500',
'00579nam 22002178a 4500',
'00661nam 22002538a 4500',
'00603cam 22002054a 4500',
'00696nam 22002538a 4500',
);
my $count = 0;
while ( my $record = $batch->next() ) {
$count++;
is( $record->leader(), shift(@leaders), "found leader $count" );
is( $record->title(), shift(@titles), "found title $count" );
}
MARC-XML-1.0.3/t/batch-ns.xml0000644000175000017500000006312312231514525013462 0ustar gmcgmc
00755cam 22002414a 4500
fol05731351
IMchF
20000613133448.0
000107s2000 nyua 001 0 eng
00020737
0471383147 (paper/cd-rom : alk. paper)
DLC
DLC
DLC
pcc
QA76.73.P22
M33 2000
005.13/3
21
Martinsson, Tobias,
1976-
ActivePerl with ASP and ADO /
Tobias Martinsson.
New York :
John Wiley & Sons,
2000.
xxi, 289 p. :
ill. ;
23 cm. +
1 computer laser disc (4 3/4 in.)
"Wiley Computer Publishing."
Perl (Computer program language)
Active server pages.
ActiveX.
00647pam 2200241 a 4500
fol05754809
IMchF
20000601115601.0
000203s2000 mau 001 0 eng
00022023
1565926994
DLC
DLC
DLC
pcc
QA76.73.P22
D47 2000
005.74
21
Descartes, Alligator.
Programming the Perl DBI /
Alligator Descartes and Tim Bunce.
Cmabridge, MA :
O'Reilly,
2000.
1111
p. cm.
Perl (Computer program language)
Database management.
Bunce, Tim.
00605cam 22002054a 4500
fol05843555
IMchF
20000525142739.0
000318s1999 cau b 001 0 eng
00501349
DLC
DLC
DLC
pcc
QA76.73.P22
B763 1999
005.13/3
21
Brown, Martin C.
Perl :
programmer's reference /
Martin C. Brown.
Berkeley :
Osborne/McGraw-Hill,
c1999.
xix, 380 p. ;
22 cm.
Includes bibliographical references and index.
Perl (Computer program language)
00579cam 22002054a 4500
fol05843579
IMchF
20000525142716.0
000318s1999 caua 001 0 eng
00502116
0072120002
DLC
DLC
DLC
pcc
QA76.73.P22
B762 1999
005.13/3
21
Brown, Martin C.
Perl :
the complete reference /
Martin C. Brown.
Berkeley :
Osborne/McGraw-Hill,
c1999.
xxxv, 1179 p. :
ill. ;
24 cm.
Perl (Computer program language)
00801nam 22002778a 4500
fol05848297
IMchF
20000524125727.0
000518s2000 mau 001 0 eng
00041664
1565924193
DLC
DLC
pcc
QA76.73.P22
G84 2000
005.2/762
21
Guelich, Scott.
CGI programming with Perl /
Scott Guelich, Shishir Gundavaram & Gunther Birznieks.
2nd ed., expanded & updated
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
CGI (Computer network protocol)
Internet programming.
Gundavaram, Shishir.
Birznieks, Gunther.
00665nam 22002298a 4500
fol05865950
IMchF
20000615103017.0
000612s2000 mau 100 0 eng
00055759
0596000138
DLC
DLC
pcc
QA76.73.P22
P475 2000
005.13/3
21
Perl Conference 4.0
(2000 :
Monterey, Calif.)
Proceedings of the Perl Conference 4.0 :
July 17-20, 2000, Monterey, California.
1st ed.
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
Congresses.
00579nam 22002178a 4500
fol05865956
IMchF
20000615102948.0
000612s2000 mau 000 0 eng
00055770
1565926099
DLC
DLC
pcc
QA76.73.P22
B43 2000
005.13/3
21
Blank-Edelman, David N.
Perl for system administration /
David N. Blank-Edelman.
Cambridge, Mass. :
O'Reilly,
2000.
0006
p. cm.
Perl (Computer program language)
00661nam 22002538a 4500
fol05865967
IMchF
20000615102611.0
000614s2000 mau 000 0 eng
00055799
0596000278
DLC
DLC
pcc
QA76.73.P22
W35 2000
005.13/3
21
Wall, Larry.
Programming Perl /
Larry Wall, Tom Christiansen & Jon Orwant.
3rd ed.
Cambridge, Mass. :
O'Reilly,
2000.
0007
p. cm.
Perl (Computer program language)
Christiansen, Tom.
Orwant, Jon.
00603cam 22002054a 4500
fol05872355
IMchF
20000706095105.0
000315s1999 njua 001 0 eng
00500678
013020868X
DLC
DLC
DLC
pcc
QA76.73.P22
L69 1999
005.13/3
21
Lowe, Vincent
(Vincent D.)
Perl programmer's interactive workbook /
Vincent Lowe.
Upper Saddle River, NJ :
Prentice Hall PTP,
c1999.
xx, 633 p. :
ill. ;
23 cm.
Perl (Computer program language)
00696nam 22002538a 4500
fol05882032
IMchF
20000707091904.0
000630s2000 cau 001 0 eng
00058174
0764547291 (alk. paper)
DLC
DLC
pcc
QA76.73.P22
F64 2000
005.13/3
21
Foster-Johnson, Eric.
Cross-platform Perl /
Eric F. Johnson.
Foster City, CA :
IDG Books Worldwide,
2000.
0009
p. cm.
Includes index.
Perl (Computer program language)
Web servers.
Cross-platform software development.
MARC-XML-1.0.3/t/parser.t0000644000175000017500000000077212231514525012723 0ustar gmcgmcuse strict;
use warnings;
use XML::LibXML;
use MARC::File::XML;
use Scalar::Util qw/refaddr/;
use Test::More tests => 3;
MARC::File::XML->set_parser('abc'); # pass an intentionally bogus parser
ok(!defined($MARC::File::XML::parser), 'cannot feed it a bogus parser');
my $external_parser = XML::LibXML->new();
MARC::File::XML->set_parser($external_parser);
ok(defined($MARC::File::XML::parser), 'gave it a parser');
ok(refaddr($external_parser) == refaddr($MARC::File::XML::parser), 'gave it a parser');
MARC-XML-1.0.3/t/empty-record.xml0000644000175000017500000000006212231514525014366 0ustar gmcgmc
MARC-XML-1.0.3/t/empty-record.t0000644000175000017500000000075712231514525014044 0ustar gmcgmcuse strict;
use warnings;
use Test::More tests => 4;
use MARC::Record;
use MARC::File::XML;
use MARC::Batch;
foreach my $file (qw{t/empty-record.xml t/empty-record-2.xml}) {
open my $IN, '<', $file;
my $xml = join('', <$IN>);
close $IN;
my $r;
eval { $r = MARC::Record->new_from_xml($xml, 'UTF-8'); };
ok(!$@, "do not throw an exception when parsing an empty record ($file)");
my @fields = $r->fields();
is(@fields, 0, "MARC::Record object is empty ($file)");
}
MARC-XML-1.0.3/t/escape.mrc0000644000175000017500000000133012231514525013174 0ustar gmcgmc00727nam 2200205 a 450000100110000000500170001100800410002803500200006905000220008910000220011124500520013325000260018526000420021130000200025365000560027365000560032965000560038594900740044159600060051503-001645819971103184734.0970701s1997 oru u000 0 eng u a(Sirsi) a35166400aML270.2b.A6 19971 aAnthony, James R.00aFrench baroque music from Beaujoyeulx to Rameau aRev. and expanded ed. aPortland, OR :bAmadeus Press,c1997. a586 p. :bmusic 0aMusic",
"Galen Charlton "
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.120351",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "MARC-XML",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"MARC::Charset" : "0.98",
"MARC::Record" : "2",
"XML::LibXML" : "1.66"
}
}
},
"release_status" : "stable",
"version" : "v1.0.3"
}
MARC-XML-1.0.3/lib/0000755000175000017500000000000012270121411011526 5ustar gmcgmcMARC-XML-1.0.3/lib/MARC/0000755000175000017500000000000012270121411012250 5ustar gmcgmcMARC-XML-1.0.3/lib/MARC/File/0000755000175000017500000000000012270121411013127 5ustar gmcgmcMARC-XML-1.0.3/lib/MARC/File/XML.pm0000644000175000017500000004037112270121302014131 0ustar gmcgmcpackage MARC::File::XML;
use warnings;
use strict;
use vars qw( $VERSION %_load_args );
use base qw( MARC::File );
use MARC::Record;
use MARC::Field;
use XML::LibXML;
use MARC::Charset qw( marc8_to_utf8 utf8_to_marc8 );
use IO::File;
use Carp qw( croak );
use Encode ();
$VERSION = '1.0.3';
our $parser;
sub import {
my $class = shift;
%_load_args = @_;
$_load_args{ DefaultEncoding } ||= 'UTF-8';
$_load_args{ RecordFormat } ||= 'USMARC';
}
=head1 NAME
MARC::File::XML - Work with MARC data encoded as XML
=head1 SYNOPSIS
## Loading with USE options
use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => 'UNIMARC' );
## Setting the record format without USE options
MARC::File::XML->default_record_format('USMARC');
## reading with MARC::Batch
my $batch = MARC::Batch->new( 'XML', $filename );
my $record = $batch->next();
## or reading with MARC::File::XML explicitly
my $file = MARC::File::XML->in( $filename );
my $record = $file->next();
## serialize a single MARC::Record object as XML
print $record->as_xml();
## write a bunch of records to a file
my $file = MARC::File::XML->out( 'myfile.xml' );
$file->write( $record1 );
$file->write( $record2 );
$file->write( $record3 );
$file->close();
## instead of writing to disk, get the xml directly
my $xml = join( "\n",
MARC::File::XML::header(),
MARC::File::XML::record( $record1 ),
MARC::File::XML::record( $record2 ),
MARC::File::XML::footer()
);
=head1 DESCRIPTION
The MARC-XML distribution is an extension to the MARC-Record distribution for
working with MARC21 data that is encoded as XML. The XML encoding used is the
MARC21slim schema supplied by the Library of Congress. More information may
be obtained here: http://www.loc.gov/standards/marcxml/
You must have MARC::Record installed to use MARC::File::XML. In fact
once you install the MARC-XML distribution you will most likely not use it
directly, but will have an additional file format available to you when you
use MARC::Batch.
This version of MARC-XML supersedes an the versions ending with 0.25 which
were used with the MARC.pm framework. MARC-XML now uses MARC::Record
exclusively.
If you have any questions or would like to contribute to this module please
sign on to the perl4lib list. More information about perl4lib is available
at L.
=head1 METHODS
When you use MARC::File::XML your MARC::Record objects will have two new
additional methods available to them:
=head2 MARC::File::XML->default_record_format([$format])
Sets or returns the default record format used by MARC::File::XML. Valid
formats are B, B, B and B.
MARC::File::XML->default_record_format('UNIMARC');
=cut
sub default_record_format {
my $self = shift;
my $format = shift;
$_load_args{RecordFormat} = $format if ($format);
return $_load_args{RecordFormat};
}
=head2 as_xml()
Returns a MARC::Record object serialized in XML. You can pass an optional format
parameter to tell MARC::File::XML what type of record (USMARC, UNIMARC, UNIMARCAUTH) you are
serializing.
print $record->as_xml([$format]);
=cut
sub MARC::Record::as_xml {
my $record = shift;
my $format = shift || $_load_args{RecordFormat};
return( MARC::File::XML::encode( $record, $format ) );
}
=head2 as_xml_record([$format])
Returns a MARC::Record object serialized in XML without a collection wrapper.
You can pass an optional format parameter to tell MARC::File::XML what type of
record (USMARC, UNIMARC, UNIMARCAUTH) you are serializing.
print $record->as_xml_record('UNIMARC');
=cut
sub MARC::Record::as_xml_record {
my $record = shift;
my $format = shift || $_load_args{RecordFormat};
return( MARC::File::XML::encode( $record, $format, 1 ) );
}
=head2 new_from_xml([$encoding, $format])
If you have a chunk of XML and you want a record object for it you can use
this method to generate a MARC::Record object. You can pass an optional
encoding parameter to specify which encoding (UTF-8 or MARC-8) you would like
the resulting record to be in. You can also pass a format parameter to specify
the source record type, such as UNIMARC, UNIMARCAUTH, USMARC or MARC21.
my $record = MARC::Record->new_from_xml( $xml, $encoding, $format );
Note: only works for single record XML chunks.
=cut
sub MARC::Record::new_from_xml {
my $xml = shift;
## to allow calling as MARC::Record::new_from_xml()
## or MARC::Record->new_from_xml()
$xml = shift if ( ref($xml) || ($xml eq "MARC::Record") );
my $enc = shift || $_load_args{BinaryEncoding};
my $format = shift || $_load_args{RecordFormat};
return( MARC::File::XML::decode( $xml, $enc, $format ) );
}
=pod
If you want to write records as XML to a file you can use out() with write()
to serialize more than one record as XML.
=head2 out()
A constructor for creating a MARC::File::XML object that can write XML to a
file. You must pass in the name of a file to write XML to. If the $encoding
parameter or the DefaultEncoding (see above) is set to UTF-8 then the binmode
of the output file will be set appropriately.
my $file = MARC::File::XML->out( $filename [, $encoding] );
=cut
sub out {
my ( $class, $filename, $enc ) = @_;
my $fh = IO::File->new( ">$filename" ) or croak( $! );
$enc ||= $_load_args{DefaultEncoding};
if ($enc =~ /^utf-?8$/oi) {
$fh->binmode(':utf8');
} else {
$fh->binmode(':raw');
}
my %self = (
filename => $filename,
fh => $fh,
header => 0,
encoding => $enc
);
return( bless \%self, ref( $class ) || $class );
}
=head2 write()
Used in tandem with out() to write records to a file.
my $file = MARC::File::XML->out( $filename );
$file->write( $record1 );
$file->write( $record2 );
=cut
sub write {
my ( $self, $record, $enc ) = @_;
if ( ! $self->{ fh } ) {
croak( "MARC::File::XML object not open for writing" );
}
if ( ! $record ) {
croak( "must pass write() a MARC::Record object" );
}
## print the XML header if we haven't already
if ( ! $self->{ header } ) {
$enc ||= $self->{ encoding } || $_load_args{DefaultEncoding};
$self->{ fh }->print( header( $enc ) );
$self->{ header } = 1;
}
## print out the record
$self->{ fh }->print( record( $record ) ) || croak( $! );
return( 1 );
}
=head2 close()
When writing records to disk the filehandle is automatically closed when you
the MARC::File::XML object goes out of scope. If you want to close it explicitly
use the close() method.
=cut
sub close {
my $self = shift;
if ( $self->{ fh } ) {
$self->{ fh }->print( footer() ) if $self->{ header };
$self->{ fh } = undef;
$self->{ filename } = undef;
$self->{ header } = undef;
}
return( 1 );
}
## makes sure that the XML file is closed off
sub DESTROY {
shift->close();
}
=pod
If you want to generate batches of records as XML, but don't want to write to
disk you'll have to use header(), record() and footer() to generate the
different portions.
$xml = join( "\n",
MARC::File::XML::header(),
MARC::File::XML::record( $record1 ),
MARC::File::XML::record( $record2 ),
MARC::File::XML::record( $record3 ),
MARC::File::XML::footer()
);
=head2 header()
Returns a string of XML to use as the header to your XML file.
=cut
sub header {
my $enc = shift;
$enc = shift if ( $enc && (ref($enc) || ($enc eq "MARC::File::XML")) );
$enc ||= 'UTF-8';
return( <
MARC_XML_HEADER
}
=head2 footer()
Returns a string of XML to use at the end of your XML file.
=cut
sub footer {
return( "" );
}
=head2 record()
Returns a chunk of XML suitable for placement between the header and the footer.
=cut
sub record {
my $record = shift;
my $format = shift;
my $include_full_record_header = shift;
my $enc = shift;
$format ||= $_load_args{RecordFormat};
my $_transcode = 0;
my $ldr = $record->leader;
my $original_encoding = substr($ldr,9,1);
# Does the record think it is already Unicode?
if ($original_encoding ne 'a' && lc($format) !~ /^unimarc/o) {
# If not, we'll make it so
$_transcode++;
substr($ldr,9,1,'a');
$record->leader( $ldr );
}
my @xml = ();
if ($include_full_record_header) {
push @xml, <
HEADER
} else {
push( @xml, "" );
}
push( @xml, " " . escape( $record->leader ) . "" );
foreach my $field ( $record->fields() ) {
my ($tag) = escape( $field->tag() );
if ( $field->is_control_field() ) {
my $data = $field->data;
push( @xml, qq( ) .
escape( ($_transcode ? marc8_to_utf8($data) : $data) ). qq() );
} else {
my ($i1) = escape( $field->indicator( 1 ) );
my ($i2) = escape( $field->indicator( 2 ) );
push( @xml, qq( ) );
foreach my $subfield ( $field->subfields() ) {
my ( $code, $data ) = ( escape( $$subfield[0] ), $$subfield[1] );
push( @xml, qq( ).
escape( ($_transcode ? marc8_to_utf8($data) : $data) ).qq() );
}
push( @xml, " " );
}
}
push( @xml, "\n" );
if ($_transcode) {
substr($ldr,9,1,$original_encoding);
$record->leader( $ldr );
}
return( join( "\n", @xml ) );
}
my %ESCAPES = (
'&' => '&',
'<' => '<',
'>' => '>',
);
my $_base_escape_regex = join( '|', map { "\Q$_\E" } keys %ESCAPES );
my $ESCAPE_REGEX = qr/$_base_escape_regex/;
sub escape {
my $string = shift;
return '' if ! defined $string or $string eq '';
$string =~ s/($ESCAPE_REGEX)/$ESCAPES{$1}/oge;
return( $string );
}
sub _next {
my $self = shift;
my $fh = $self->{ fh };
## return undef at the end of the file
return if eof($fh);
## get a chunk of xml for a record
local $/ = 'record>';
my $xml = <$fh>;
## do we have enough?
$xml .= <$fh> if $xml !~ m!$!;
## trim stuff before the start record element
$xml =~ s/.*?<(([^:]+:){0,1})record.*?>/<$1record>/s;
## return undef if there isn't a good chunk of xml
return if ( $xml !~ m|<(([^:]+:){0,1})record>.*|s );
## if we have a namespace prefix, restore the declaration
if ($xml =~ /<([^:]+:)record>/) {
$xml =~ s!<([^:]+):record>!<$1:record xmlns:$1="http://www.loc.gov/MARC21/slim">!;
}
## return the chunk of xml
return( $xml );
}
sub _parser {
$parser ||= XML::LibXML->new(
ext_ent_handler => sub {
die "External entities are not supported\n";
}
);
return $parser;
}
=head2 decode()
You probably don't ever want to call this method directly. If you do
you should pass in a chunk of XML as the argument.
It is normally invoked by a call to next(), see L or L.
=cut
sub decode {
my $self = shift;
my $text;
my $location = '';
if ( ref($self) =~ /^MARC::File/ ) {
$location = 'in record '.$self->{recnum};
$text = shift;
} else {
$location = 'in record 1';
$text = $self=~/MARC::File/ ? shift : $self;
}
my $enc = shift || $_load_args{BinaryEncoding};
my $format = shift || $_load_args{RecordFormat};
my $parser = _parser();
my $xml = $parser->parse_string($text);
my $root = $xml->documentElement;
croak('MARCXML document has no root element') unless defined $root;
if ($root->localname eq 'collection') {
my @records = $root->getChildrenByLocalName('record');
croak('MARCXML document has no record element') unless @records;
$root = $records[0];
}
my $rec = MARC::Record->new();
my @leaders = $root->getElementsByLocalName('leader');
my $transcode_to_marc8 = 0;
if (@leaders) {
my $leader = $leaders[0]->textContent;
# this bit is rather questionable
$transcode_to_marc8 = substr($leader, 9, 1) eq 'a' && decideMARC8Binary($format, $enc) ? 1 : 0;
substr($leader, 9, 1) = ' ' if $transcode_to_marc8;
$rec->leader($leader);
}
my @fields = ();
foreach my $elt ($root->getChildrenByLocalName('*')) {
if ($elt->localname eq 'controlfield') {
push @fields, MARC::Field->new($elt->getAttribute('tag'), $elt->textContent);
} elsif ($elt->localname eq 'datafield') {
my @sfs = ();
foreach my $sfelt ($elt->getChildrenByLocalName('subfield')) {
push @sfs, $sfelt->getAttribute('code'),
$transcode_to_marc8 ? utf8_to_marc8($sfelt->textContent()) : $sfelt->textContent();
}
push @fields, MARC::Field->new(
$elt->getAttribute('tag'),
$elt->getAttribute('ind1'),
$elt->getAttribute('ind2'),
@sfs
);
}
}
$rec->append_fields(@fields);
return $rec;
}
=head2 MARC::File::XML->set_parser($parser)
Pass a XML::LibXML parser to MARC::File::XML
for it to use. This is optional, meant for
use by applications that maintain a shared
parser object or which require that external
entities be processed. Note that the latter
is a potential security risk; see
L.
=cut
sub set_parser {
my $self = shift;
$parser = shift;
undef $parser unless ref($parser) =~ /XML::LibXML/;
}
sub decideMARC8Binary {
my $format = shift;
my $enc = shift;
return 0 if (defined($format) && lc($format) =~ /^unimarc/o);
return 0 if (defined($enc) && lc($enc) =~ /^utf-?8/o);
return 1;
}
=head2 encode()
You probably want to use the as_xml() method on your MARC::Record object
instead of calling this directly. But if you want to you just need to
pass in the MARC::Record object you wish to encode as XML, and you will be
returned the XML as a scalar.
=cut
sub encode {
my $record = shift;
my $format = shift || $_load_args{RecordFormat};
my $without_collection_header = shift;
my $enc = shift || $_load_args{DefaultEncoding};
if (lc($format) =~ /^unimarc/o) {
$enc = _unimarc_encoding( $format => $record );
}
my @xml = ();
push( @xml, header( $enc ) ) unless ($without_collection_header);
# verbose, but naming the header output flags this way to avoid
# the potential confusion identified in CPAN bug #34082
# http://rt.cpan.org/Public/Bug/Display.html?id=34082
my $include_full_record_header = ($without_collection_header) ? 1 : 0;
push( @xml, record( $record, $format, $include_full_record_header, $enc ) );
push( @xml, footer() ) unless ($without_collection_header);
return( join( "\n", @xml ) );
}
sub _unimarc_encoding {
my $f = shift;
my $r = shift;
my $pos = 26;
$pos = 13 if (lc($f) eq 'unimarcauth');
my $enc = substr( $r->subfield(100 => 'a'), $pos, 2 );
if ($enc eq '01' || $enc eq '03') {
return 'ISO-8859-1';
} elsif ($enc eq '50') {
return 'UTF-8';
} else {
die "Unsupported UNIMARC character encoding [$enc] for XML output for $f; 100\$a -> " . $r->subfield(100 => 'a');
}
}
=head1 TODO
=over 4
=item * Support for callback filters in decode().
=back
=head1 SEE ALSO
=over 4
=item L
=item L
=item L
=item L
=back
=head1 AUTHORS
=over 4
=item * Ed Summers
=back
=cut
1;
MARC-XML-1.0.3/Changes0000644000175000017500000001536312270121244012267 0ustar gmcgmcRevision history for Perl extension MARC-XML
1.0.3 Thu Jan 23 05:02:52 UTC 2014
- fix t/external-entities.t to pass on Strawberry
1.0.2 Tue Jan 21 17:18:37 UTC 2014
- MARC::File::XML will now die upon parsing a record that
declares an external entity and tries to use it. This
prevents the potential unwanted disclosure of the contents
of files on the server by applications that embed this module.
If, for some reason, an application needs to process MARCXML
records that contain external entities, set_parser() can be
used to force the use of an XML::LibXML parser that is
configured to process external entities.
The issue was reported by John Lightsey.
1.0.1 Fri Feb 15 08:25:04 PST 2013
- RT#83284: return empty MARC::Record given empty
1.0 Sun Feb 10 21:32:32 PST 2013
- Use XML::LibXML rather than XML::SAX to parse MARCXML records.
This offers a significant speed improvement for record parsing;
in some tests, parsing time on a large file was reduced by 80%.
This also avoids problems caused by character encoding bugs in
XML::SAX::PurePerl.
- Add method to let client code give MARC::File::XML a shared
XML::LibXML parser object.
0.93 Fri Feb 11 17:13:02 EST 2011
- When slurping MARCXML records (e.g., via MARC::Batch), can
now handle XML files that use a prefix
to refer to the http://www.loc.gov/MARC21/slim namespace.
- If trying to parse a MARCXML record that has omitted
the wrapper element, throw an exception
with a more meaningful error message.
- adjusted copyright statement further to meet Debian requirements
(RT#48333)
- set license in Makefile.PL
0.92 Thu Jul 30 22:37:07 EDT 2009
- small documentation changes to close RT tickets #48334 and #48333
filed by Jonathan from Debian world.
- added license string to META.yml so that CPAN can pick it up
0.91 Tue Jul 28 2009
- Nixing the stray space (always been there) in the schemaLocation
attribute for single-record output
- Properly apply the leader modification for USMARC to signal UTF-8
encoding.
- Escape '<', '>', and '&' used as indicator values and subfield labels
during XML output (Bill Erickson)
- CPAN RT#34082: clarify names of header output switches
0.90 Fri Dec 14 2007
- modifications to MARC::File::SAX to use LocalName rather than Name
Name can contain a namespace prefix and cause parsing to fail
Should be ok to rely on LocalName since the parser factory is
requiring Namespace support?
- MARC::File::SAX also can build up multiple records now, for use
in other SAX contexts like Net::OAI::Harvester. This required
a few changes in MARC::File::XML as well.
0.88 Wed Nov 28 2007
- String test for subfield code to avoid dropping $0 (Galen Charlton)
0.88_1 Tue Oct 23 2007
- Fixed a typo in M::F::X that could be the origin of the test failure(miker)
- Removed some useless (and confusing) code that
throws away some character set mapping information in the 066 (miker)
0.85 Fri Feb 13 2007
- fixed typo in handling of unimarc w/regard to marc8 (ppoulain)
0.84 Mon Nov 26 2006
- Fixed UNIMARC encoding detection logic (miker)
- Added UNIMARC Authority support (miker)
0.83 Fri Apr 21 15:19:20 EST 2006
- remove premature return from close() thanks Jay Luker (exlibris)
0.82 March 4, 2006
- details unknown :(
0.81 Fri Feb 3 23:29:04 EST 2006
- minor changes so that diagnostics (when character mappings aren't found)
will not throw warnings about unitialized variables too.
0.8 Fri Feb 3 22:49:11 EST 2006
- overhaul by Mike Rylander to use the new MARC::Charset for mapping
back and forth from marc8 encoding to utf8 encoding
- Makefile.PL requires v0.9 of MARC::Charset to be installed
0.7 Thu Apr 14 11:54:24 CDT 2005
- marc2xml uses MARC::Batch in lenient mode, thanks Rob Casson.
0.66 Thu Sep 23 01:12:20 CDT 2004
- added ability to change the encoding attribute.
0.65 Wed May 19 21:22:23 2004
- added marc2xml and xml2marc utilities
0.61 Mon May 09 10:32:55 2004
- need to require MARC::Record v1.36 since it renames is_control_tag()
to is_control_field().
0.6 Sat May 08 02:23:04 2004
- rudimentary XML encoding (thanks to Peter Robertson for inquiring
about it)
0.53 Mon Dec 01 17:32:01 2003
- fixed to still process XML that has namespaces on record element
thanks Clay Redding at princeton.edu.
0.52 Wed Oct 29 20:18:44 2003
- fixed doc bug
0.51 Thu Sep 04 10:33:12 2003
- fixed warnings in MARC::File::SAX which were emitted under new
Test::Harness.
- docfix in MARC::File::XML.
0.5 Thu Jul 29 13:55:38 2003
- updated so that it uses LC's MARCXML schema
- updated so that it can plug into MARC::Record
0.4 Sun Apr 23 20:50:47 CDT 2000
- Update "Windows" test in Makefile.PL
- Needs MARC 1.07 to cover recent fixes and incompatibilities
- Perl 5.6.0 warns on "join (//,", change to "join (''," instead.
- add $MARC::TEST to t/test?.t
- various documentation fixes
0.3 Tue Jan 25 15:43:55 CST 2000
- update to XML::Parser 2.27 and MARC 1.04
- add Document Type Declaration support
- header defaults to "US-ASCII"
- add character set output processing and ansel_default
- add entity input translation and register_default
- add incremental input file processing: openxml, nextxml, closexml
- add eg/pacific.pl, eg/pacific0.dat, and eg/read_pfa.pl
- add t/ansel.ent and expand test2.t
- rename $XDEBUG, add $XTEST and xcarp()
- add "wrapper" methods output_header, output_body, output_footer
0.26 Fri Jan 7 22:35:40 EST 2000
- Corrected dangerous interpolation in field_ handler
0.25 Tue Nov 23 11:32:16 CST 1999
- original CPAN-style version; created by h2xs 1.18
- linux command: h2xs -A -X -n MARC::XML
- added Makefile.PL, MANIFEST, README, etc.
- ported t directory and tests from MARC.pm, added test4.t
- surgery--XML::Parser wants global subs and other scope changes.
- cleanup inheritance details
- add "ordered" option to new()
- numerous documentation changes
0.2 Sun Nov 21 18:49:00 EST 1999
- removed MARC::XML specific pod from MARC.pm and added to MARC::XML
0.1 Sun Nov 14 21:59:00 EST 1999
- created MARC::XML subclass to handle MARC<->XML conversions
- moved _marc2xml() from MARC.pm into MARC::XML
0.01 Tue Jul 29 13:55:38 2003
- original release
MARC-XML-1.0.3/META.yml0000644000175000017500000000103712270121412012233 0ustar gmcgmc---
abstract: unknown
author:
- 'Ed Summers '
- 'Galen Charlton '
build_requires:
ExtUtils::MakeMaker: 0
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.82, CPAN::Meta::Converter version 2.120351'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: MARC-XML
no_index:
directory:
- t
- inc
requires:
MARC::Charset: 0.98
MARC::Record: 2
XML::LibXML: 1.66
version: v1.0.3
MARC-XML-1.0.3/README0000644000175000017500000000123312231514525011650 0ustar gmcgmcMARC-XML
--------
MARC-XML is an extension to the MARC-Record distribution for working with
XML data encoded using the MARC21slim XML schema from the Library of Congress.
For more details see: http://www.loc.gov/standards/marcxml/
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
- MARC::Record
- MARC::Charset
- XML::SAX
COPYRIGHT AND LICENCE
Copyright (C) 2003-2009 Ed Summers and contributors
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.