LP#957466: Fix invalid MARCXML syntax
authorRemington Steed <rjs7@calvin.edu>
Tue, 24 Feb 2015 18:25:16 +0000 (13:25 -0500)
committerDan Wells <dbw2@calvin.edu>
Tue, 24 Feb 2015 19:06:17 +0000 (14:06 -0500)
This commit fixes some invalid MARCXML syntax, and also makes the XPath
query more general to allow for namespaces on the tags.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm

index dad61a6..9dafe41 100644 (file)
@@ -2138,10 +2138,10 @@ sub set_marc_905u {
     my ($class, $marcdoc, $username) = @_;
 
     # Look for existing 905$u subfields. If any exist, do nothing.
-    my @nodes = $marcdoc->findnodes('//field[@tag="905"]/subfield[@code="u"]');
+    my @nodes = $marcdoc->findnodes('//*[@tag="905"]/*[@code="u"]');
     unless (@nodes) {
         # We create a new 905 and the subfield u to that.
-        my $parentNode = $marcdoc->createElement('field');
+        my $parentNode = $marcdoc->createElement('datafield');
         $parentNode->setAttribute('tag', '905');
         $parentNode->setAttribute('ind1', '');
         $parentNode->setAttribute('ind2', '');