[open-ils-commits] r15860 - branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 16 10:17:36 EDT 2010
Author: miker
Date: 2010-03-16 10:17:34 -0400 (Tue, 16 Mar 2010)
New Revision: 15860
Modified:
branches/rel_1_6_0/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: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2010-03-16 14:17:16 UTC (rev 15859)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2010-03-16 14:17:34 UTC (rev 15860)
@@ -123,6 +123,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