Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub convertMARCtoXML
- {
- my $self = shift;
- my $marc = shift;
- my $thisXML = '';
- local $@;
- eval
- {
- # Turn on dying from warnings
- # MARC::Charset can throw warnings here, and we don't want to continue if we get some
- local $SIG{__WARN__} = sub { die @_; };
- $thisXML = $marc->as_xml();
- 1;
- } or do
- {
- $marc->encoding('UTF-8');
- $thisXML = $marc->as_xml();
- };
- $thisXML =~ s/\n//sog;
- $thisXML =~ s/^<\?xml.+\?\s*>//go;
- $thisXML =~ s/>\s+</></go;
- $thisXML =~ s/\p{Cc}//go;
- $thisXML = entityize($self, $thisXML);
- $thisXML =~ s/[\x00-\x1f]//go;
- $thisXML =~ s/^\s+//;
- $thisXML =~ s/\s+$//;
- $thisXML =~ s/<record><leader>/<leader>/;
- $thisXML =~ s/<collection/<record/;
- $thisXML =~ s/<\/record><\/collection>/<\/record>/;
- return $thisXML;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement