[open-ils-commits] r15858 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 16 10:16:54 EDT 2010
Author: miker
Date: 2010-03-16 10:16:52 -0400 (Tue, 16 Mar 2010)
New Revision: 15858
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
Log:
Patch from Galen Charlton: removes empty controlfield elements, which can be produced in a couple different ways during the ingest of slightly invalid MARC records
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2010-03-16 14:14:37 UTC (rev 15857)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2010-03-16 14:16:52 UTC (rev 15858)
@@ -111,6 +111,11 @@
my $marcxml = XML::LibXML->new->parse_string($xml);
$marcxml->documentElement->setNamespace($MARC_NAMESPACE, "marc", 1 );
$marcxml->documentElement->setNamespace($MARC_NAMESPACE);
+ # remove empty control fields - at least one source of records adds ersatz blank 008s
+ # that become empty controlfield elements
+ foreach my $controlfield ($marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'controlfield')) {
+ $controlfield->parentNode->removeChild($controlfield) unless $controlfield->hasChildNodes();
+ }
return $marcxml;
}
More information about the open-ils-commits
mailing list