/usr/bin/xml2marc is in libmarc-xml-perl 1.0.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
=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 );
}
|